----------------------------------------------------------------------------------------
      name:  <unnamed>
       log:  C:\Users\jwright\Dropbox\Research\Autocratic Instability\R&A Revision\Wrigh
> tBak Replication\AutocraticInstability.log
  log type:  text
 opened on:   9 Dec 2015, 12:24:19

. 
. 
. do Polity

. **************************************************************************
. ** Polity.do                                                            **
. ** Joseph Wright, josephgwright@gmail.com                               **
. ** Date created: August 6, 2013                                         **
. ** Date updated: October 14, 2015                                       **
. **                                                                      **
. ** Parent file:                                                         **
. **     AutocraticInstability.do                                         **
. **                                                                      **
. ** Using data:                                                          **
. **     Polity.dta                                                       **
. **                                                                      **
. **************************************************************************
. 
. use polity, clear

. set scheme lean1

. tsset cowcode year
       panel variable:  cowcode (unbalanced)
        time variable:  year, 1800 to 2011, but with gaps
                delta:  1 unit

. 
. egen caseid = group(gwf_case)
(10140 missing values generated)

. 
. gen lag_POL_polity = l.POL_polity
(2,042 missing values generated)

. gen lag_POL_polity2 = l.POL_polity2
(2,260 missing values generated)

. gen lead_POL_polity = F.POL_polity
(1,985 missing values generated)

. gen lead_POL_polity2 = F.POL_polity2
(2,206 missing values generated)

. 
. gen lag2_POL_polity = l2.POL_polity
(2,231 missing values generated)

. gen lag2_POL_polity2 = l2.POL_polity2
(2,446 missing values generated)

. gen lead2_POL_polity = F2.POL_polity
(2,120 missing values generated)

. gen lead2_POL_polity2 = F2.POL_polity2
(2,337 missing values generated)

. 
. gen gwfregimetype = .
(18,094 missing values generated)

. replace gwfregimetype = 1 if gwf_regime=="democracy" & gwf_regime~=""
(3,200 real changes made)

. replace gwfregimetype = 2 if gwf_regime~="democracy" & gwf_regime~=""
(4,754 real changes made)

. replace gwfregimetype = 3 if gwf_regime=="provisional" & gwf_regime~=""
(37 real changes made)

. replace gwfregimetype = 4 if gwf_regime=="warlord" & gwf_regime~=""
(52 real changes made)

. replace gwfregimetype = 5 if gwf_regime=="foreign-occupied" & gwf_regime~=""
(31 real changes made)

. replace gwfregimetype = 6 if gwf_regime=="warlord/foreign-occupied" & gwf_regime~=""
(29 real changes made)

. replace gwfregimetype = 7 if gwf_regime=="not-independent" & gwf_regime~=""
(18 real changes made)

. label define GWF_Regime_Type 1 "democracy" 2 "autocracy" 3 "provisional" 4 "warlord" 5
>  "foreign-occupied" 6 "warlord/foreign-occupied" 7 "not-independent"

. label values gwfregimetype GWF_Regime_Type

. 
. gen gwfregimefail = .
(18,094 missing values generated)

. replace gwfregimefail = 1 if gwf_fail==1 & gwf_fail~=. & ((F.gwfregimetype==3 & gwfreg
> imetype==2) | (F.gwfregimetype==3 & gwfregimetype==4) | (F.gwfregimetype==1 & gwfregim
> etype==3) | (F.gwfregimetype==1 & gwfregimetype==2) | (F.gwfregimetype==1 & gwfregimet
> ype==4) | (F.gwfregimetype==1 & gwfregimetype==5) | (F.gwfregimetype==1 & gwfregimetyp
> e==6) | (F.gwfregimetype==1 & gwfregimetype==7))
(129 real changes made)

. replace gwfregimefail = 2 if gwf_fail==1 & gwf_fail~=. & ((F.gwfregimetype==2 & gwfreg
> imetype==2) | (F.gwfregimetype==2 & gwfregimetype==4) | (F.gwfregimetype==2 & gwfregim
> etype==5) | (F.gwfregimetype==2 & gwfregimetype==6) | (F.gwfregimetype==2 & gwfregimet
> ype==7))  
(111 real changes made)

. replace gwfregimefail = 3 if gwf_fail==1 & ((F.gwfregimetype==2 & gwfregimetype==1) | 
> (F.gwfregimetype==2 & gwfregimetype==3)) 
(79 real changes made)

. label define GWF_regimefail 1 "Democratic transition" 2 "Autocratic transition" 3 "Dem
> ocratic failure" 

. label values gwfregimefail GWF_regimefail

. 
. gen regimefail = .
(18,094 missing values generated)

. replace regimefail = 0 if POL_fail~=.
(14,977 real changes made)

. replace regimefail = -88 if POL_polity==-66 | POL_polity==-77   /* foreign interruptio
> n and interregunum */
(412 real changes made)

. replace regimefail = -88 if l.POL_polity==.                     /* new countries with 
> no prior polity score */
(2,038 real changes made)

. sort cow year

. 
. ** Democratic Transitions
. replace regimefail = 1 if POL_fail==1 & gwfregimefail==1
(94 real changes made)

. replace regimefail = 1 if POL_fail==1 & (F.gwfregimefail==1)  & gwf_fail==0 & caseid==
> F.caseid 
(37 real changes made)

. replace regimefail = 1 if POL_fail==1 & (F2.gwfregimefail==1)  & gwf_fail==0 & caseid=
> =F2.caseid 
(12 real changes made)

. replace regimefail = 1 if POL_fail==1 & gwf_fail==1 & gwf_fail~=. & ((F.gwfregimetype=
> =3 & gwfregimetype==2) | (F.gwfregimetype==1 & gwfregimetype==3) | (F.gwfregimetype==1
>  & gwfregimetype==2)) 
(0 real changes made)

. replace regimefail = 1 if POL_fail==1 & gwf_fail~=1 & gwf_fail~=. &  POL_polity>=6 & l
> ag_POL_polity<6 & l.gwf_fail==1
(11 real changes made)

. replace regimefail = 1 if POL_fail==1 & gwf_fail~=1 & gwf_fail~=. & (F.regimefail==1 |
>  F2.regimefail==1)
(8 real changes made)

. replace regimefail = 1 if POL_fail==1 & gwf_fail~=1 & L.POL_polity==-88 & L.gwfregimef
> ail==1
(4 real changes made)

. 
. ** Autocratic transitions and consolidation
. replace regimefail = 3 if POL_fail==1 & gwfregimefail==2  
(58 real changes made)

. replace regimefail = 3 if POL_fail==1 & gwf_fail~=1 & gwf_fail~=. &  (l.gwfregimefail=
> =2 | l2.gwfregimefail==2) & POL_polity2<6 & POL_polity<lag_POL_polity
(12 real changes made)

. replace regimefail = 3 if POL_fail==1 & gwf_fail~=1 & gwf_fail~=. & POL_polity==-88 & 
> regimefail~=1 & (F.regimefail==3 | F2.regimefail==3)   
(6 real changes made)

. replace regimefail = 3 if POL_fail==1 & gwf_fail~=1 & L.POL_polity==-88 & L.regimefail
> ==3
(23 real changes made)

. replace regimefail = 3 if POL_fail==1 & gwf_fail~=1 & L.POL_polity==-88 & L.regimefail
> ==3 & L2.regimefail==3
(0 real changes made)

. 
. ** Democratic failure
. replace regimefail = 5 if POL_fail==1 & gwfregimefail==3
(54 real changes made)

. replace regimefail = 5 if POL_fail==1 & gwf_fail~=. & ((F.gwfregimetype==2 & gwfregime
> type==1) | (F.gwfregimetype==2 & gwfregimetype==3)) 
(0 real changes made)

. replace regimefail = 5 if POL_fail==1 & gwf_fail~=. & (F.regimefail==5 | F2.regimefail
> ==5) & (L.POL_polity2>POL_polity2) & L.gwfregimetype<3 
(6 real changes made)

. 
. ** Institutional Liberalization
. recode regimefail (0=2) if POL_fail==1 & gwf_fail~=1 & gwf_fail~=. & regimefail~=1 & L
> .POL_polity2<POL_polity2 & (L.POL_polity~=-66 & L.POL_polity~=-77) & (POL_polity~=-66 
> & POL_polity~=-77) & L.POL_polity~=. & POL_polity~=.
(regimefail: 138 changes made)

. recode regimefail (0=2) if POL_fail==1 & gwf_fail~=1 & gwf_fail~=. & regimefail~=1 & L
> .POL_polity2==POL_polity2 & (L.POL_polity~=-66 & L.POL_polity~=-77) & (POL_polity~=-66
>  & POL_polity~=-77) & L.POL_polity~=. & POL_polity~=. & (F.regimefail==2 | F2.regimefa
> il==2 | F3.regimefail==2)
(regimefail: 10 changes made)

. recode regimefail (0=2) if POL_fail==1 & gwf_fail~=1 & gwf_fail~=. & regimefail==0 & P
> OL_polity2>lag_POL_polity2 & lag_POL_polity2~=.
(regimefail: 4 changes made)

. recode regimefail (0=2) if POL_fail==1 & gwf_fail~=1 & gwf_fail~=. & regimefail==0 & P
> OL_polity2>lag2_POL_polity2 & lag2_POL_polity2~=.
(regimefail: 3 changes made)

. 
. ** Institutional de-liberalization
. recode regimefail (0=4) if POL_fail==1 & gwf_fail~=1 & gwf_fail~=. & L.POL_polity2>POL
> _polity2 & (L.POL_polity~=-66 & L.POL_polity~=-77) & (POL_polity~=-66 & POL_polity~=-7
> 7) & L.POL_polity~=. & POL_polity~=.
(regimefail: 76 changes made)

. recode regimefail (0=4) if POL_fail==1 & gwf_fail~=1 & gwf_fail~=. & L.POL_polity2==PO
> L_polity2 & (L.POL_polity~=-66 & L.POL_polity~=-77) & (POL_polity~=-66 & POL_polity~=-
> 77) & L.POL_polity~=. & POL_polity~=. & (F.regimefail==4 | F2.regimefail==4 | F3.regim
> efail==4)
(regimefail: 7 changes made)

. recode regimefail (0=4) if POL_fail==1 & gwf_fail~=1 & gwf_fail~=. & regimefail==0 & P
> OL_polity2<lag_POL_polity2 & lag_POL_polity2~=.
(regimefail: 4 changes made)

. recode regimefail (0=4) if POL_fail==1 & gwf_fail~=1 & gwf_fail~=. & regimefail==0 & l
> ead_POL_polity2<lag2_POL_polity2 & lag2_POL_polity2~=.
(regimefail: 13 changes made)

. recode regimefail (0=4) if POL_fail==1 & gwf_fail~=1 & gwf_fail~=. & regimefail==0 & l
> ead2_POL_polity2<POL_polity2 & lead2_POL_polity2~=.
(regimefail: 1 changes made)

. 
. ** Durable failures that occur in countries not included in the GWF data set
. recode regimefail (0=-88) if POL_fail==1 & gwf_fail==.
(regimefail: 467 changes made)

. ** Durable failures that result when a regime remains in power but merges with another
>  country
. bysort cowcode (year): replace regimefail = -88 if F.gwf_fail==. & L.gwf_fail~=.
(283 real changes made)

. ** Durable failures that occur in a transition from interruption or interregnum **
. recode regimefail (0=-88) if POL_fail==1 & (lag_POL_polity==-66 | lag_POL_polity==-77)
(regimefail: 7 changes made)

.  
.  
. ** Cases where Polity and GWF code the same event of regime transition (e.g., December
>  election and January inauguration or December step-down and January election)
. ** In these cases, we follow the GWF coding rule to avoid multiple counts of regime tr
> ansition that are more frequently observed in Polity. 
. * replace regimefail = 0 if cowcode==90  & year==1996  
. * replace regimefail = 0 if cowcode==165 & year==1985  
. * replace regimefail = 0 if cowcode==452 & year==2001  
. * replace regimefail = 0 if cowcode==475 & year==1984  
. * replace regimefail = 0 if cowcode==771 & year==1991  
. * replace regimefail = 0 if cowcode==771 & year==2009 
. 
. ** NO CHANGE in POLITY score **
. recode POL_fail (1=0) if regimefail==0 & (POL_polity==-88 | POL_polity2==POL_polity) &
>  POL_polity2==lag_POL_polity2 & POL_polity2==lag2_POL_polity2 & POL_polity2==lead_POL_
> polity2 & POL_polity2==lead2_POL_polity2
(POL_fail: 12 changes made)

. recode POL_fail (1=0) if regimefail==0 & (POL_polity2==POL_polity) & POL_polity2==lag_
> POL_polity2 &  lag2_POL_polity2==. & POL_polity2==lead_POL_polity2 &  POL_polity2==lea
> d2_POL_polity2
(POL_fail: 3 changes made)

. 
. label define Fail_Type 1 "Democratic transitions" 2 "Institutional liberalization" 3 "
> Autocratic transitions" 4 "Institutional deliberalization" 5 "Democratic failure" 

. label values regimefail Fail_Type

. tab regimefail 

                    regimefail |      Freq.     Percent        Cum.
-------------------------------+-----------------------------------
                           -88 |      3,177       18.85       18.85
                             0 |     13,096       77.71       96.56
        Democratic transitions |        165        0.98       97.54
  Institutional liberalization |        154        0.91       98.46
        Autocratic transitions |         99        0.59       99.04
Institutional deliberalization |        101        0.60       99.64
            Democratic failure |         60        0.36      100.00
-------------------------------+-----------------------------------
                         Total |     16,852      100.00

. tab gwfregimefail

        gwfregimefail |      Freq.     Percent        Cum.
----------------------+-----------------------------------
Democratic transition |        129       40.44       40.44
Autocratic transition |        111       34.80       75.24
   Democratic failure |         79       24.76      100.00
----------------------+-----------------------------------
                Total |        319      100.00

. 
. gen graphgwfpolity = .
(18,094 missing values generated)

. replace graphgwfpolity = 165 in 1  /* Durable: Democratic Transitions */
(1 real change made)

. replace graphgwfpolity = 129 in 2  /* GWF: Democratic Transition */
(1 real change made)

. replace graphgwfpolity = . in 3  
(0 real changes made)

. replace graphgwfpolity = 154 in 4  /* Durable: Institutional Liberalization */
(1 real change made)

. replace graphgwfpolity = . in 5  
(0 real changes made)

. replace graphgwfpolity = 99 in 6  /* Durable: Autocratic Transitions */
(1 real change made)

. replace graphgwfpolity = 111 in 7  /* GWF: Autocratic Transitions */
(1 real change made)

. replace graphgwfpolity = . in 8  
(0 real changes made)

. replace graphgwfpolity = 101 in 9  /* Durable: Institutional Deliberalization */
(1 real change made)

. replace graphgwfpolity = . in 10  
(0 real changes made)

. replace graphgwfpolity = 60  in 11  /* Durable: Democratic Failure */
(1 real change made)

. replace graphgwfpolity = 79  in 12  /* GWF: Democratic Failure */
(1 real change made)

. gen index = _n in 1/12
(18,082 missing values generated)

. label define allfails 1 "Autocracy -" 2 "  Democracy" /*
> */ 3 " "  4 "Institutional liberalization" 5 " " 6 "Autocracy -" 7 "  Autocracy" /*
> */ 8 " " 9 "Institutional de-liberalization" 10 " " 11 "Democracy -" 12 "  Autocracy"

. label values index allfails

. 
. twoway (bar graphgwfpolity index if index~=2 & index~=7 & index~=12,  scheme(lean2) ) 
> /*
> */  (scatter graphgwfpolity index if index~=2 & index~=7 & index~=12,   ms(none) mla(g
> raphgwfpolity) mlabpos(6))/*
> */ (bar graphgwfpolity index if index==2 | index==7 | index==12, ylabel(0(60)180,glcol
> or(gs14)) /*
> */ xlabel(1(1)12, valuelabel labsize(vsmall) labcolor(black) labgap(tiny) noticks) xsi
> ze(7) ysize(4) /*
> */  graphregion(color(white)) xtitle("Type of event",height(8)) ytitle("Number of coun
> try-years")  xscale(range (0 12)) ) /*
> */ (scatter graphgwfpolity index if index==2 | index==7 | index==12, ms(none) mla(grap
> hgwfpolity) mlabpos(6) /*
> */    legend(pos(12) col(4) ring(1) label(1 "Polity durable failure") label(2 "") /*
> */ label(3 "GWF regime transition") label(4 "") bmargin(0)) )
(note:  named style 0 not found in class margin, default attributes used)

. *graph export "C:\Users\jwright\Documents\My Dropbox\Research\Autocratic Instability\D
> urableGWF.pdf", as(pdf)                            replace
. 
. ******************************************
. **********Morrison Replication************
. ******************************************
. 
. gen poldv = politydv
(12,341 missing values generated)

. gen nt = l.nontaxtotalpc/1000
(16,061 missing values generated)

. logit poldv nt gdpgrowth l.lnincome d.urbanpop elf  l.lnpopdens l.pastpolitydv politya
> ge polityageknot1 polityageknot2 if l.polity~=-77 & polity~=-77 & polity2~=-77 & l.pol
> ity2~=-77, cluster(bankscode)

Iteration 0:   log pseudolikelihood = -392.31748  
Iteration 1:   log pseudolikelihood = -369.61998  
Iteration 2:   log pseudolikelihood = -325.29463  
Iteration 3:   log pseudolikelihood =  -322.7273  
Iteration 4:   log pseudolikelihood =  -322.5035  
Iteration 5:   log pseudolikelihood =  -322.5005  
Iteration 6:   log pseudolikelihood =  -322.5005  

Logistic regression                             Number of obs     =      1,808
                                                Wald chi2(10)     =     125.24
                                                Prob > chi2       =     0.0000
Log pseudolikelihood =  -322.5005               Pseudo R2         =     0.1780

                              (Std. Err. adjusted for 104 clusters in bankscode)
--------------------------------------------------------------------------------
               |               Robust
         poldv |      Coef.   Std. Err.      z    P>|z|     [95% Conf. Interval]
---------------+----------------------------------------------------------------
            nt |  -.6607784   .2286653    -2.89   0.004    -1.108954   -.2126026
     gdpgrowth |   -.056452   .0199745    -2.83   0.005    -.0956012   -.0173027
               |
      lnincome |
           L1. |  -.1922178   .1059463    -1.81   0.070    -.3998688    .0154332
               |
      urbanpop |
           D1. |   .5699208   .2490988     2.29   0.022     .0816961    1.058145
               |
           elf |  -.0314755   .5412132    -0.06   0.954    -1.092234    1.029283
               |
     lnpopdens |
           L1. |   -.016125   .0894254    -0.18   0.857    -.1913955    .1591455
               |
  pastpolitydv |
           L1. |  -.0109314   .0559308    -0.20   0.845    -.1205537    .0986909
               |
     polityage |  -.3703636   .0561857    -6.59   0.000    -.4804856   -.2602416
polityageknot1 |   .0013052   .0002299     5.68   0.000     .0008547    .0017558
polityageknot2 |  -.0000554   .0000199    -2.79   0.005    -.0000944   -.0000165
         _cons |    .420455   .9691396     0.43   0.664    -1.479024    2.319934
--------------------------------------------------------------------------------

. gen s = e(sample)

. 
. tab regimefail poldv if s

                      |         poldv
           regimefail |         0          1 |     Total
----------------------+----------------------+----------
                  -88 |        17          4 |        21 
                    0 |     1,686          1 |     1,687 
Democratic transition |         0         42 |        42 
Institutional liberal |         3         27 |        30 
Autocratic transition |         0         16 |        16 
Institutional deliber |         0          6 |         6 
   Democratic failure |         0          6 |         6 
----------------------+----------------------+----------
                Total |     1,706        102 |     1,808 


. browse cow country year regimefail poldv POL_fail POL_durable POL_polity POL_polity2 l
> ag_*  if s==1 & regimefail~=. & (  (poldv==1 & regimefail<=0) | (poldv==0 & regimefail
> >0) )

. 
. gen demTR= poldv==1 & regimefail==1

. replace demTR = 1 if (cow==165 & year==1985) | (cow==255 & year==1990)  /* original ha
> s Uruguay 1985 and Germany 1990 as regime fail; these are actual the year post-regime 
> fail, but counted as democratic transition years for comparison */
(1 real change made)

. 
. gen demFAIL = poldv==1 & regimefail==5

. 
. gen dictCON =poldv==1 & regimefail==3

. replace dictCON = 1 if cow==517 & year==1993  /* This is due to earlier coding error b
> y Polity, which was corrected in a later release;  regime collapse occurs in 1994 when
>  rebels take Kigali */
(1 real change made)

. replace dictCON=1 if cow==580 & (year==1973 | year==1974) /* These are two years prior
>  to an autocratic transition in 1975; maybe an old version of Polity had these as Dura
> ble failure years? */
(2 real changes made)

. 
. gen instLIB = poldv==1 & regimefail==2

. 
. gen instDELIB = poldv==1 & regimefail==4

. replace instDELIB=1 if cow==110 & (year>=1978 & year<=1980)  /* This is -88  in the up
> dated polity; Guyana had deliberalization in 1980, according to Polity2; PNC and Burnh
> am were incumbents who won the 1980 election */
(3 real changes made)

. 
. saveold temp_Polity, replace
(saving in Stata 13 format)
(FYI, saveold has options version(12) and version(11) that write files in older Stata
      formats)
file temp_Polity.dta saved

. 
. *Replication of Model 2, Table 3
. logit poldv nt gdpgrowth l.lnincome d.urbanpop elf  l.lnpopdens l.pastpolitydv politya
> ge polityageknot1 polityageknot2 if l.polity~=-77 & polity~=-77 & polity2~=-77 & l.pol
> ity2~=-77, cluster(bankscode)

Iteration 0:   log pseudolikelihood = -392.31748  
Iteration 1:   log pseudolikelihood = -369.61998  
Iteration 2:   log pseudolikelihood = -325.29463  
Iteration 3:   log pseudolikelihood =  -322.7273  
Iteration 4:   log pseudolikelihood =  -322.5035  
Iteration 5:   log pseudolikelihood =  -322.5005  
Iteration 6:   log pseudolikelihood =  -322.5005  

Logistic regression                             Number of obs     =      1,808
                                                Wald chi2(10)     =     125.24
                                                Prob > chi2       =     0.0000
Log pseudolikelihood =  -322.5005               Pseudo R2         =     0.1780

                              (Std. Err. adjusted for 104 clusters in bankscode)
--------------------------------------------------------------------------------
               |               Robust
         poldv |      Coef.   Std. Err.      z    P>|z|     [95% Conf. Interval]
---------------+----------------------------------------------------------------
            nt |  -.6607784   .2286653    -2.89   0.004    -1.108954   -.2126026
     gdpgrowth |   -.056452   .0199745    -2.83   0.005    -.0956012   -.0173027
               |
      lnincome |
           L1. |  -.1922178   .1059463    -1.81   0.070    -.3998688    .0154332
               |
      urbanpop |
           D1. |   .5699208   .2490988     2.29   0.022     .0816961    1.058145
               |
           elf |  -.0314755   .5412132    -0.06   0.954    -1.092234    1.029283
               |
     lnpopdens |
           L1. |   -.016125   .0894254    -0.18   0.857    -.1913955    .1591455
               |
  pastpolitydv |
           L1. |  -.0109314   .0559308    -0.20   0.845    -.1205537    .0986909
               |
     polityage |  -.3703636   .0561857    -6.59   0.000    -.4804856   -.2602416
polityageknot1 |   .0013052   .0002299     5.68   0.000     .0008547    .0017558
polityageknot2 |  -.0000554   .0000199    -2.79   0.005    -.0000944   -.0000165
         _cons |    .420455   .9691396     0.43   0.664    -1.479024    2.319934
--------------------------------------------------------------------------------

. estimates store m1

. lroc, nograph

Logistic model for poldv

number of observations =     1808
area under ROC curve   =   0.8095

. tab poldv if s

      poldv |      Freq.     Percent        Cum.
------------+-----------------------------------
          0 |      1,706       94.36       94.36
          1 |        102        5.64      100.00
------------+-----------------------------------
      Total |      1,808      100.00

. 
. *Model 2, Table 3 (democratic transition)
. xi:   logit  demTR nt gdpgrowth l.lnincome d.urbanpop elf  l.lnpopdens l.pastpolitydv 
> polityage polityageknot1 polityageknot2 if l.polity~=-77 & polity~=-77 & polity2~=-77 
> & l.polity2~=-77  , cluster(bankscode)

Iteration 0:   log pseudolikelihood = -203.25195  
Iteration 1:   log pseudolikelihood = -198.26651  
Iteration 2:   log pseudolikelihood = -177.32969  
Iteration 3:   log pseudolikelihood = -177.03406  
Iteration 4:   log pseudolikelihood = -177.02081  
Iteration 5:   log pseudolikelihood = -177.02079  
Iteration 6:   log pseudolikelihood = -177.02079  

Logistic regression                             Number of obs     =      1,808
                                                Wald chi2(10)     =      66.37
                                                Prob > chi2       =     0.0000
Log pseudolikelihood = -177.02079               Pseudo R2         =     0.1291

                              (Std. Err. adjusted for 104 clusters in bankscode)
--------------------------------------------------------------------------------
               |               Robust
         demTR |      Coef.   Std. Err.      z    P>|z|     [95% Conf. Interval]
---------------+----------------------------------------------------------------
            nt |  -.6827221   .2609618    -2.62   0.009    -1.194198   -.1712464
     gdpgrowth |  -.0628076   .0330477    -1.90   0.057    -.1275799    .0019647
               |
      lnincome |
           L1. |   .1863757   .1644839     1.13   0.257    -.1360068    .5087581
               |
      urbanpop |
           D1. |   .9414142   .3312297     2.84   0.004     .2922159    1.590613
               |
           elf |   .4793463   .8637868     0.55   0.579    -1.213645    2.172337
               |
     lnpopdens |
           L1. |   .1867843   .1267258     1.47   0.141    -.0615936    .4351623
               |
  pastpolitydv |
           L1. |  -.0610658    .079649    -0.77   0.443     -.217175    .0950433
               |
     polityage |  -.3477389   .0976352    -3.56   0.000    -.5391004   -.1563774
polityageknot1 |   .0011858    .000377     3.15   0.002     .0004468    .0019248
polityageknot2 |  -.0000406   .0000221    -1.83   0.067     -.000084    2.77e-06
         _cons |  -4.469062   1.432906    -3.12   0.002    -7.277506   -1.660618
--------------------------------------------------------------------------------

. estimates store m2

. lroc, nograph

Logistic model for demTR

number of observations =     1808
area under ROC curve   =   0.7715

. tab poldv demTR if e(sample)

           |         demTR
     poldv |         0          1 |     Total
-----------+----------------------+----------
         0 |     1,706          0 |     1,706 
         1 |        59         43 |       102 
-----------+----------------------+----------
     Total |     1,765         43 |     1,808 


.  
. 
. *Model 2, Table 3 (democratic failure)
. xi:   logit demFAIL  nt gdpgrowth l.lnincome d.urbanpop elf  l.lnpopdens l.pastpolityd
> v polityage polityageknot1 polityageknot2 if l.polity~=-77 & polity~=-77 & polity2~=-7
> 7 & l.polity2~=-77  , cluster(bankscode)

Iteration 0:   log pseudolikelihood = -40.239336  
Iteration 1:   log pseudolikelihood = -38.711931  
Iteration 2:   log pseudolikelihood = -35.581387  
Iteration 3:   log pseudolikelihood = -35.384603  
Iteration 4:   log pseudolikelihood = -35.207587  
Iteration 5:   log pseudolikelihood =  -34.69529  
Iteration 6:   log pseudolikelihood = -33.999509  
Iteration 7:   log pseudolikelihood = -33.626704  
Iteration 8:   log pseudolikelihood =  -33.53072  
Iteration 9:   log pseudolikelihood = -33.529803  
Iteration 10:  log pseudolikelihood = -33.529802  

Logistic regression                             Number of obs     =      1,808
                                                Wald chi2(10)     =      59.02
                                                Prob > chi2       =     0.0000
Log pseudolikelihood = -33.529802               Pseudo R2         =     0.1667

                              (Std. Err. adjusted for 104 clusters in bankscode)
--------------------------------------------------------------------------------
               |               Robust
       demFAIL |      Coef.   Std. Err.      z    P>|z|     [95% Conf. Interval]
---------------+----------------------------------------------------------------
            nt |  -.8041566   .4352251    -1.85   0.065    -1.657182    .0488689
     gdpgrowth |  -.0544744   .0705665    -0.77   0.440    -.1927823    .0838334
               |
      lnincome |
           L1. |   .4173556   .1810396     2.31   0.021     .0625246    .7721866
               |
      urbanpop |
           D1. |  -.7929771   .7007239    -1.13   0.258    -2.166371    .5804165
               |
           elf |    1.93366    1.40956     1.37   0.170    -.8290275    4.696347
               |
     lnpopdens |
           L1. |  -.2940891   .2824461    -1.04   0.298    -.8476732     .259495
               |
  pastpolitydv |
           L1. |   .1727016   .0999497     1.73   0.084    -.0231963    .3685994
               |
     polityage |  -.3885811   .3025857    -1.28   0.199    -.9816382     .204476
polityageknot1 |   .0037625   .0023922     1.57   0.116    -.0009261    .0084511
polityageknot2 |  -.0034864   .0021702    -1.61   0.108      -.00774    .0007671
         _cons |  -7.567926   2.284307    -3.31   0.001    -12.04509   -3.090767
--------------------------------------------------------------------------------
Note: 710 failures and 0 successes completely determined.

. estimates store m3

. lroc, nograph

Logistic model for demFAIL

number of observations =     1808
area under ROC curve   =   0.8905

. tab poldv demFAIL  if e(sample)

           |        demFAIL
     poldv |         0          1 |     Total
-----------+----------------------+----------
         0 |     1,706          0 |     1,706 
         1 |        96          6 |       102 
-----------+----------------------+----------
     Total |     1,802          6 |     1,808 


.  
. 
. *Model 2, Table 3 (autocratic transition and consolidation)
. xi:   logit dictCON  nt gdpgrowth l.lnincome d.urbanpop elf  l.lnpopdens l.pastpolityd
> v polityage polityageknot1 polityageknot2 if l.polity~=-77 & polity~=-77 & polity2~=-7
> 7 & l.polity2~=-77  , cluster(bankscode)

Iteration 0:   log pseudolikelihood = -105.45503  
Iteration 1:   log pseudolikelihood = -85.093576  
Iteration 2:   log pseudolikelihood =  -75.87328  
Iteration 3:   log pseudolikelihood = -74.924847  
Iteration 4:   log pseudolikelihood = -74.581048  
Iteration 5:   log pseudolikelihood = -74.468659  
Iteration 6:   log pseudolikelihood = -74.464943  
Iteration 7:   log pseudolikelihood =  -74.46493  
Iteration 8:   log pseudolikelihood =  -74.46493  

Logistic regression                             Number of obs     =      1,808
                                                Wald chi2(10)     =      94.53
                                                Prob > chi2       =     0.0000
Log pseudolikelihood =  -74.46493               Pseudo R2         =     0.2939

                              (Std. Err. adjusted for 104 clusters in bankscode)
--------------------------------------------------------------------------------
               |               Robust
       dictCON |      Coef.   Std. Err.      z    P>|z|     [95% Conf. Interval]
---------------+----------------------------------------------------------------
            nt |   .2131482   .2523147     0.84   0.398    -.2813795    .7076759
     gdpgrowth |  -.0953395   .0466838    -2.04   0.041    -.1868381   -.0038409
               |
      lnincome |
           L1. |  -.9993164   .3623496    -2.76   0.006    -1.709509   -.2891242
               |
      urbanpop |
           D1. |   .8638612   1.069031     0.81   0.419    -1.231401    2.959124
               |
           elf |   .6649478   1.748385     0.38   0.704    -2.761824     4.09172
               |
     lnpopdens |
           L1. |   .0157839   .2585696     0.06   0.951    -.4910031    .5225709
               |
  pastpolitydv |
           L1. |  -.2173297    .271992    -0.80   0.424    -.7504242    .3157648
               |
     polityage |   -.645446   .1756722    -3.67   0.000    -.9897572   -.3011347
polityageknot1 |   .0024639   .0008354     2.95   0.003     .0008266    .0041012
polityageknot2 |  -.0001551   .0001026    -1.51   0.131    -.0003562     .000046
         _cons |    4.40039    2.79397     1.57   0.115    -1.075691    9.876471
--------------------------------------------------------------------------------
Note: 91 failures and 0 successes completely determined.

. estimates store m4

. lroc, nograph

Logistic model for dictCON

number of observations =     1808
area under ROC curve   =   0.9248

. tab poldv dictCON if e(sample)

           |        dictCON
     poldv |         0          1 |     Total
-----------+----------------------+----------
         0 |     1,706          0 |     1,706 
         1 |        83         19 |       102 
-----------+----------------------+----------
     Total |     1,789         19 |     1,808 


.  
. gen demALL = demTR==1 | instLIB==1   if regimefail~=.  & s==1
(16,286 missing values generated)

. gen dictALL = dictCON==1 | instDELIB==1  if regimefail~=.  & s==1
(16,286 missing values generated)

. 
. xi:   logit demALL  nt gdpgrowth l.lnincome d.urbanpop elf  l.lnpopdens l.pastpolitydv
>  polityage polityageknot1 polityageknot2 if l.polity~=-77 & polity~=-77 & polity2~=-77
>  & l.polity2~=-77  , cluster(bankscode)

Iteration 0:   log pseudolikelihood = -296.23077  
Iteration 1:   log pseudolikelihood = -285.02951  
Iteration 2:   log pseudolikelihood = -255.70141  
Iteration 3:   log pseudolikelihood = -254.61929  
Iteration 4:   log pseudolikelihood =  -254.5213  
Iteration 5:   log pseudolikelihood = -254.52054  
Iteration 6:   log pseudolikelihood = -254.52054  

Logistic regression                             Number of obs     =      1,808
                                                Wald chi2(10)     =      70.02
                                                Prob > chi2       =     0.0000
Log pseudolikelihood = -254.52054               Pseudo R2         =     0.1408

                              (Std. Err. adjusted for 104 clusters in bankscode)
--------------------------------------------------------------------------------
               |               Robust
        demALL |      Coef.   Std. Err.      z    P>|z|     [95% Conf. Interval]
---------------+----------------------------------------------------------------
            nt |  -.7641835   .2497643    -3.06   0.002    -1.253713   -.2746544
     gdpgrowth |  -.0401725   .0242141    -1.66   0.097    -.0876313    .0072863
               |
      lnincome |
           L1. |  -.0594364    .137531    -0.43   0.666    -.3289923    .2101195
               |
      urbanpop |
           D1. |    .715521   .2963383     2.41   0.016     .1347086    1.296333
               |
           elf |  -.4366117   .7121495    -0.61   0.540    -1.832399    .9591757
               |
     lnpopdens |
           L1. |   .0425445   .1061525     0.40   0.689    -.1655106    .2505996
               |
  pastpolitydv |
           L1. |    .020747   .0649507     0.32   0.749    -.1065541     .148048
               |
     polityage |  -.3649948   .0808919    -4.51   0.000    -.5235401   -.2064496
polityageknot1 |    .001324   .0003131     4.23   0.000     .0007103    .0019377
polityageknot2 |  -.0000577    .000023    -2.51   0.012    -.0001027   -.0000127
         _cons |  -1.307937   1.269197    -1.03   0.303    -3.795516    1.179643
--------------------------------------------------------------------------------

. estimates store m5

. lroc, nograph

Logistic model for demALL

number of observations =     1808
area under ROC curve   =   0.7866

. tab poldv demALL if e(sample)

           |        demALL
     poldv |         0          1 |     Total
-----------+----------------------+----------
         0 |     1,706          0 |     1,706 
         1 |        32         70 |       102 
-----------+----------------------+----------
     Total |     1,738         70 |     1,808 


. 
. xi:   logit dictALL  nt gdpgrowth l.lnincome d.urbanpop elf  l.lnpopdens l.pastpolityd
> v polityage polityageknot1 polityageknot2 if l.polity~=-77 & polity~=-77 & polity2~=-7
> 7 & l.polity2~=-77  , cluster(bankscode)

Iteration 0:   log pseudolikelihood = -136.10103  
Iteration 1:   log pseudolikelihood = -110.87173  
Iteration 2:   log pseudolikelihood =  -100.2011  
Iteration 3:   log pseudolikelihood = -99.322132  
Iteration 4:   log pseudolikelihood = -99.144925  
Iteration 5:   log pseudolikelihood = -99.119112  
Iteration 6:   log pseudolikelihood = -99.118792  
Iteration 7:   log pseudolikelihood = -99.118792  

Logistic regression                             Number of obs     =      1,808
                                                Wald chi2(10)     =     131.72
                                                Prob > chi2       =     0.0000
Log pseudolikelihood = -99.118792               Pseudo R2         =     0.2717

                              (Std. Err. adjusted for 104 clusters in bankscode)
--------------------------------------------------------------------------------
               |               Robust
       dictALL |      Coef.   Std. Err.      z    P>|z|     [95% Conf. Interval]
---------------+----------------------------------------------------------------
            nt |   .0766446   .3194509     0.24   0.810    -.5494676    .7027568
     gdpgrowth |  -.0828975   .0364127    -2.28   0.023     -.154265   -.0115299
               |
      lnincome |
           L1. |  -.8592633   .2758777    -3.11   0.002    -1.399974   -.3185529
               |
      urbanpop |
           D1. |   .1288351   .8938931     0.14   0.885    -1.623163    1.880833
               |
           elf |   .9321148   1.608541     0.58   0.562    -2.220568    4.084798
               |
     lnpopdens |
           L1. |  -.1863712    .223203    -0.83   0.404     -.623841    .2510986
               |
  pastpolitydv |
           L1. |  -.2122333   .1887043    -1.12   0.261    -.5820869    .1576203
               |
     polityage |  -.4532304    .106752    -4.25   0.000    -.6624604   -.2440004
polityageknot1 |   .0015456   .0005333     2.90   0.004     .0005004    .0025908
polityageknot2 |  -.0000711   .0000542    -1.31   0.189    -.0001774    .0000351
         _cons |   4.529273   2.429523     1.86   0.062    -.2325052    9.291052
--------------------------------------------------------------------------------
Note: 35 failures and 0 successes completely determined.

. estimates store m6

. lroc, nograph

Logistic model for dictALL

number of observations =     1808
area under ROC curve   =   0.9149

. tab poldv dictALL if e(sample)

           |        dictALL
     poldv |         0          1 |     Total
-----------+----------------------+----------
         0 |     1,706          0 |     1,706 
         1 |        76         26 |       102 
-----------+----------------------+----------
     Total |     1,782         26 |     1,808 


. 
. estout  m1 m2 m3 m4 m5 m6 using Table1.tex, cells(b(star  fmt(%9.3f)) se(par fmt(%9.2f
> ))) stats(ll r2 N) style(tex) replace label starlevels(* 0.10 ** 0.05)
(output written to Table1.tex)

. saveold temp, replace
(saving in Stata 13 format)
(FYI, saveold has options version(12) and version(11) that write files in older Stata
      formats)
file temp.dta saved

. 
. 
. ****************
. ** Sample DVs **
. ****************
. 
. use temp, clear

. gen type = ""
(18,094 missing values generated)

. replace type = "Dem tr" if demTR==1
variable type was str1 now str6
(123 real changes made)

. replace type = "Dem fail" if demFAIL==1
variable type was str6 now str8
(44 real changes made)

. replace type = "Inst lib" if instLIB==1
(94 real changes made)

. replace type = "Inst de-lib" if instDEL==1
variable type was str8 now str11
(58 real changes made)

. replace type = "Aut tr" if dictCON==1
(78 real changes made)

. 
.         * All Durable failures in the sample *
. sort country year

. browse country year type  if s==1 & poldv==1

. 
.         * GWF transitions in sample that are not Durable failures *
. sort gwf_case year

. browse gwf_case year gwfregimefail   if s==1 & poldv==0 & gwfregimefail>0 & gwfregimef
> ail~=.

. 
.         * All GWF democratic failures when no Polity Durable failure *
. browse gwf_case year regimefail gwfregimefail POL_fail POL_polity lag_POL_polity if gw
> fregimefail==3 & regimefail~=5

. 
.         * All GWF Autocracy to Autocracy transitions when no Polity Durable failure *
. browse gwf_case year regimefail gwfregimefail POL_fail POL_polity lag_POL_polity if gw
> fregimefail==2 & regimefail~=3

. 
. *****************
. ***Simulations***
. *****************
. 
. use temp, clear

. set more off

. logit poldv nt gdpgrowth l.lnincome d.urbanpop elf  l.lnpopdens l.pastpolitydv politya
> ge polityageknot1 polityageknot2 if s, cluster(bankscode)

Iteration 0:   log pseudolikelihood = -392.31748  
Iteration 1:   log pseudolikelihood = -369.61998  
Iteration 2:   log pseudolikelihood = -325.29463  
Iteration 3:   log pseudolikelihood =  -322.7273  
Iteration 4:   log pseudolikelihood =  -322.5035  
Iteration 5:   log pseudolikelihood =  -322.5005  
Iteration 6:   log pseudolikelihood =  -322.5005  

Logistic regression                             Number of obs     =      1,808
                                                Wald chi2(10)     =     125.24
                                                Prob > chi2       =     0.0000
Log pseudolikelihood =  -322.5005               Pseudo R2         =     0.1780

                              (Std. Err. adjusted for 104 clusters in bankscode)
--------------------------------------------------------------------------------
               |               Robust
         poldv |      Coef.   Std. Err.      z    P>|z|     [95% Conf. Interval]
---------------+----------------------------------------------------------------
            nt |  -.6607784   .2286653    -2.89   0.004    -1.108954   -.2126026
     gdpgrowth |   -.056452   .0199745    -2.83   0.005    -.0956012   -.0173027
               |
      lnincome |
           L1. |  -.1922178   .1059463    -1.81   0.070    -.3998688    .0154332
               |
      urbanpop |
           D1. |   .5699208   .2490988     2.29   0.022     .0816961    1.058145
               |
           elf |  -.0314755   .5412132    -0.06   0.954    -1.092234    1.029283
               |
     lnpopdens |
           L1. |   -.016125   .0894254    -0.18   0.857    -.1913955    .1591455
               |
  pastpolitydv |
           L1. |  -.0109314   .0559308    -0.20   0.845    -.1205537    .0986909
               |
     polityage |  -.3703636   .0561857    -6.59   0.000    -.4804856   -.2602416
polityageknot1 |   .0013052   .0002299     5.68   0.000     .0008547    .0017558
polityageknot2 |  -.0000554   .0000199    -2.79   0.005    -.0000944   -.0000165
         _cons |    .420455   .9691396     0.43   0.664    -1.479024    2.319934
--------------------------------------------------------------------------------

. drawnorm b1-b11, n(10000) means(e(b)) cov(e(V))  clear 
(obs 10,000)

. gen PROBa=.
(10,000 missing values generated)

. gen PROBalow=.
(10,000 missing values generated)

. gen PROBahigh=.
(10,000 missing values generated)

. gen a =.
(10,000 missing values generated)

. gen nt_axis = (_n-1)/50 + 0 if _n<=118
(9,882 missing values generated)

. /*We want nt to run from 0 to 2.36, ie from 5pctile to 95pctile*/ 
. local a=0

. while `a' <= 2.36 {
  2.         gen x_beta  = b1*`a'+b2*3.48+b3*8.06+b4*0.4+b5*0.42+b6*3.95+b7*1.86+b8*28+b
> 9*7819+b10*33139+b11*1
  3.         gen prob = invlogit(x_beta)
  4.         egen probhat=mean(prob)
  5.       _pctile prob, p(2.5,97.5) 
  6.       scalar problow= r(r1) 
  7.       scalar probhigh= r(r2)
  8.         quietly replace a = `a' 
  9.         quietly replace PROBa =  probhat  if nt_axis==a
 10.         quietly replace PROBalow =  problow  if nt_axis==a
 11.         quietly replace PROBahigh =  probhigh  if nt_axis==a
 12.         drop x_beta prob* probhat* 
 13.         local a = `a' + .02
 14. }

. label var nt_axis "Non-tax revenue per capita (rescaled)"

. label var PROBa "Replication"

. sort nt_axis

. save Mrep1, replace
file Mrep1.dta saved

. 
. 
. use temp, clear

. set more off

. logit demTR nt gdpgrowth l.lnincome d.urbanpop elf  l.lnpopdens l.pastpolitydv politya
> ge polityageknot1 polityageknot2 if s, cluster(bankscode)

Iteration 0:   log pseudolikelihood = -203.25195  
Iteration 1:   log pseudolikelihood = -198.26651  
Iteration 2:   log pseudolikelihood = -177.32969  
Iteration 3:   log pseudolikelihood = -177.03406  
Iteration 4:   log pseudolikelihood = -177.02081  
Iteration 5:   log pseudolikelihood = -177.02079  
Iteration 6:   log pseudolikelihood = -177.02079  

Logistic regression                             Number of obs     =      1,808
                                                Wald chi2(10)     =      66.37
                                                Prob > chi2       =     0.0000
Log pseudolikelihood = -177.02079               Pseudo R2         =     0.1291

                              (Std. Err. adjusted for 104 clusters in bankscode)
--------------------------------------------------------------------------------
               |               Robust
         demTR |      Coef.   Std. Err.      z    P>|z|     [95% Conf. Interval]
---------------+----------------------------------------------------------------
            nt |  -.6827221   .2609618    -2.62   0.009    -1.194198   -.1712464
     gdpgrowth |  -.0628076   .0330477    -1.90   0.057    -.1275799    .0019647
               |
      lnincome |
           L1. |   .1863757   .1644839     1.13   0.257    -.1360068    .5087581
               |
      urbanpop |
           D1. |   .9414142   .3312297     2.84   0.004     .2922159    1.590613
               |
           elf |   .4793463   .8637868     0.55   0.579    -1.213645    2.172337
               |
     lnpopdens |
           L1. |   .1867843   .1267258     1.47   0.141    -.0615936    .4351623
               |
  pastpolitydv |
           L1. |  -.0610658    .079649    -0.77   0.443     -.217175    .0950433
               |
     polityage |  -.3477389   .0976352    -3.56   0.000    -.5391004   -.1563774
polityageknot1 |   .0011858    .000377     3.15   0.002     .0004468    .0019248
polityageknot2 |  -.0000406   .0000221    -1.83   0.067     -.000084    2.77e-06
         _cons |  -4.469062   1.432906    -3.12   0.002    -7.277506   -1.660618
--------------------------------------------------------------------------------

. drawnorm b1-b11, n(10000) means(e(b)) cov(e(V))  clear 
(obs 10,000)

. gen PROBd=.
(10,000 missing values generated)

. gen PROBdlow=.
(10,000 missing values generated)

. gen PROBdhigh=.
(10,000 missing values generated)

. gen a =.
(10,000 missing values generated)

. gen nt_axis = (_n-1)/50 + 0 if _n<=118
(9,882 missing values generated)

. /*We want nt to run from 0 to 2.36, ie from 5pctile to 95pctile*/ 
. local a=0

. while `a' <= 2.36 {
  2.         gen x_beta  = b1*`a'+b2*3.48+b3*8.06+b4*0.4+b5*0.42+b6*3.95+b7*1.86+b8*28+b
> 9*7819+b10*33139+b11*1
  3.         gen prob = invlogit(x_beta)
  4.         egen probhat=mean(prob)
  5.       _pctile prob, p(2.5,97.5) 
  6.       scalar problow= r(r1) 
  7.       scalar probhigh= r(r2) 
  8.         quietly replace a = `a' 
  9.         quietly replace PROBd =  probhat  if nt_axis==a
 10.         quietly replace PROBdlow =  problow  if nt_axis==a
 11.         quietly replace PROBdhigh =  probhigh  if nt_axis==a
 12.         drop x_beta prob* probhat* 
 13.         local a = `a' + .02
 14. }

. label var nt_axis "Non-tax revenue per capita (rescaled)"

. label var PROBd "Dem Transition"

. sort nt_axis

. save Mrep2, replace
file Mrep2.dta saved

. 
. 
. use temp, clear

. set more off

. logit dictCON nt gdpgrowth l.lnincome d.urbanpop elf  l.lnpopdens l.pastpolitydv polit
> yage polityageknot1 polityageknot2 if s, cluster(bankscode)

Iteration 0:   log pseudolikelihood = -105.45503  
Iteration 1:   log pseudolikelihood = -85.093576  
Iteration 2:   log pseudolikelihood =  -75.87328  
Iteration 3:   log pseudolikelihood = -74.924847  
Iteration 4:   log pseudolikelihood = -74.581048  
Iteration 5:   log pseudolikelihood = -74.468659  
Iteration 6:   log pseudolikelihood = -74.464943  
Iteration 7:   log pseudolikelihood =  -74.46493  
Iteration 8:   log pseudolikelihood =  -74.46493  

Logistic regression                             Number of obs     =      1,808
                                                Wald chi2(10)     =      94.53
                                                Prob > chi2       =     0.0000
Log pseudolikelihood =  -74.46493               Pseudo R2         =     0.2939

                              (Std. Err. adjusted for 104 clusters in bankscode)
--------------------------------------------------------------------------------
               |               Robust
       dictCON |      Coef.   Std. Err.      z    P>|z|     [95% Conf. Interval]
---------------+----------------------------------------------------------------
            nt |   .2131482   .2523147     0.84   0.398    -.2813795    .7076759
     gdpgrowth |  -.0953395   .0466838    -2.04   0.041    -.1868381   -.0038409
               |
      lnincome |
           L1. |  -.9993164   .3623496    -2.76   0.006    -1.709509   -.2891242
               |
      urbanpop |
           D1. |   .8638612   1.069031     0.81   0.419    -1.231401    2.959124
               |
           elf |   .6649478   1.748385     0.38   0.704    -2.761824     4.09172
               |
     lnpopdens |
           L1. |   .0157839   .2585696     0.06   0.951    -.4910031    .5225709
               |
  pastpolitydv |
           L1. |  -.2173297    .271992    -0.80   0.424    -.7504242    .3157648
               |
     polityage |   -.645446   .1756722    -3.67   0.000    -.9897572   -.3011347
polityageknot1 |   .0024639   .0008354     2.95   0.003     .0008266    .0041012
polityageknot2 |  -.0001551   .0001026    -1.51   0.131    -.0003562     .000046
         _cons |    4.40039    2.79397     1.57   0.115    -1.075691    9.876471
--------------------------------------------------------------------------------
Note: 91 failures and 0 successes completely determined.

. drawnorm b1-b11, n(10000) means(e(b)) cov(e(V))  clear 
(obs 10,000)

. gen PROBx=.
(10,000 missing values generated)

. gen PROBxlow=.
(10,000 missing values generated)

. gen PROBxhigh=.
(10,000 missing values generated)

. gen a =.
(10,000 missing values generated)

. gen nt_axis = (_n-1)/50 + 0 if _n<=118
(9,882 missing values generated)

. /*We want nt to run from 0 to 2.36, ie from 5pctile to 95pctile*/ 
. local a=0

. while `a' <= 2.36 {
  2.         gen x_beta  = b1*`a'+b2*3.48+b3*8.06+b4*0.4+b5*0.42+b6*3.95+b7*1.86+b8*28+b
> 9*7819+b10*33139+b11*1
  3.         gen prob = invlogit(x_beta)
  4.         egen probhat=mean(prob)
  5.       _pctile prob, p(2.5,97.5) 
  6.       scalar problow= r(r1) 
  7.       scalar probhigh= r(r2) 
  8.         quietly replace a = `a' 
  9.         quietly replace PROBx =  probhat  if nt_axis==a
 10.         quietly replace PROBxlow =  problow  if nt_axis==a
 11.         quietly replace PROBxhigh =  probhigh  if nt_axis==a
 12.         drop x_beta prob* probhat* 
 13.         local a = `a' + .02
 14. }

. label var nt_axis "Non-tax revenue per capita (rescaled)"

. label var PROBx "Autocratic Trans/Cons"

. sort nt_axis

. save Mrep3, replace
file Mrep3.dta saved

. 
. merge nt_axis using Mrep1
(note: you are using old merge syntax; see [D] merge for new syntax)
variable nt_axis does not uniquely identify observations in the master data
variable nt_axis does not uniquely identify observations in Mrep1.dta

. sort nt_axis

. drop _merge

. merge nt_axis using Mrep2
(note: you are using old merge syntax; see [D] merge for new syntax)
variable nt_axis does not uniquely identify observations in the master data
variable nt_axis does not uniquely identify observations in Mrep2.dta

. sort nt_axis

. drop _merge

. merge using temp
(note: you are using old merge syntax; see [D] merge for new syntax)
(label allfails already defined)
(label Fail_Type already defined)
(label GWF_regimefail already defined)
(label GWF_Regime_Type already defined)

. set scheme lean1

. label var nt "Non-tax revenue distribution"

. 
. 
. twoway  (hist nt if nt<2.4 & s==1 & nt>0, yaxis(2)  lcolor(gs12) bin(100) scheme(lean1
> )) /*
> */ (line PROBa nt_axis if nt_axis<=2.4, yaxis(1))  /*
> */ (line PROBd nt_axis if nt_axis<=2.4, yaxis(1))  /*
> */ (line PROBx nt_axis if nt_axis<=2.4, yaxis(1))  /*
> */ , yscale(range (0 0.04)) ylabel(0 (.01) 0.04) xtitle("Non-tax revenue per capita (1
> 000's)", size(3.5)) ytitle("Pr(Failure)", size(3.5)) /*
> */ legend(pos(12) col(2) ring(1) label(1 "Non-tax revenue distribution") label(2 "Repl
> ication estimate") label(3 "Democratic transition")label(4 "Autocratic transition/cons
> olidation") )

. *graph export "C:\Users\jwright\Documents\My Dropbox\Research\Autocratic Instability\M
> orrisonRep.pdf", as(pdf)                            replace
. 
. 
. ******************************
. ** 95% Confidence Intervals **
. ******************************
. 
. twoway  (hist nt if nt<2.4 & s==1 & nt>0, yaxis(2)  lcolor(gs12) bin(100) scheme(lean1
> )) /*
> */ (line PROBa PROBalow PROBahigh nt_axis if nt_axis<=2.4, clpattern(solid dash dash) 
> yaxis(1) ysc(r(0 0.08)) ylabel(#4)) /*
> */ , yscale(range (0 0.06)) ylabel(0 (.01) 0.06)  xtitle("Non-tax revenue per capita (
> 1000's)", size(4)) ytitle("Pr(Failure)", size(4)) /*
> */ legend(off)

. *graph export "C:\Users\jwright\Documents\My Dropbox\Research\Autocratic Instability\M
> orrisonRep_all95CI.pdf", as(pdf)                            replace
. 
. twoway  (hist nt if nt<2.4 & s==1 & nt>0, yaxis(2)  lcolor(gs12) bin(100) scheme(lean1
> )) /*
> */ (line PROBd PROBdlow PROBdhigh nt_axis if nt_axis<=2.4, clpattern(solid dash dash) 
> yaxis(1) ysc(r(0 0.08)) ylabel(#4))  /*
> */ ,yscale(range (0 0.06)) ylabel(0 (.01) 0.06)  xtitle("Non-tax revenue per capita (1
> 000's)", size(4)) ytitle("Pr(Failure)", size(4)) /*
> */ legend(off)

. *graph export "C:\Users\jwright\Documents\My Dropbox\Research\Autocratic Instability\M
> orrisonRep_dem95CI.pdf", as(pdf)                            replace
. 
. twoway  (hist nt if nt<2.4 & s==1 & nt>0, yaxis(2)  lcolor(gs12) bin(100) scheme(lean1
> )) /*
> */ (line PROBx PROBxlow PROBxhigh nt_axis if nt_axis<=2.4, clpattern(solid dash dash) 
> yaxis(1) ysc(r(0 0.08)) ylabel(#4)) /*
> */ ,yscale(range (0 0.06)) ylabel(0 (.01) 0.06)  xtitle("Non-tax revenue per capita (1
> 000's)", size(4)) ytitle("Pr(Failure)", size(4)) /*
> */ legend(off)

. *graph export "C:\Users\jwright\Documents\My Dropbox\Research\Autocratic Instability\M
> orrisonRep_auto95CI.pdf", as(pdf)                            replace
. 
. 
. 
. 
end of do-file

. 
. do Archigos

. **************************************************
. ** Archigos Leader exits & GWF regime failure **
. **************************************************
. use archigos_original, clear
(Archigos 2.9: A Data Set of Political Leaders)

. keep if exit==1 | exit==3 | exit==4                                             /* exc
> lude natural deaths */
(421 observations deleted)

. gen year = year(eoutdate)                                                             
>   /* identifying failure years */

. bysort ccode year: egen exitsum = count(year)                           /* identifying
>  multiple-failure years */

. keep ida ccode year exitsum leader  

. rename ccode cowcode 

. egen tag = tag(cow year)  

. keep if tag==1
(498 observations deleted)

. keep if year>1945
(917 observations deleted)

. gen leaderexit=1

. tab  exitsum leaderexit

           | leaderexit
   exitsum |         1 |     Total
-----------+-----------+----------
         1 |     1,015 |     1,015 
         2 |       148 |       148 
         3 |        34 |        34 
         4 |         7 |         7 
         5 |         1 |         1 
         7 |         1 |         1 
-----------+-----------+----------
     Total |     1,206 |     1,206 


. drop tag  

. sort cow year

. merge cow year using GWFglobal
(note: you are using old merge syntax; see [D] merge for new syntax)
(note: variable cowcode was int, now float to accommodate using data's values)

. keep if year<2005
(897 observations deleted)

. tab _merge

     _merge |      Freq.     Percent        Cum.
------------+-----------------------------------
          1 |         96        1.34        1.34
          2 |      5,946       83.14       84.48
          3 |      1,110       15.52      100.00
------------+-----------------------------------
      Total |      7,152      100.00

. browse ida year if _merge==1                                                          
>   /* small population countries not included in GWF */

. drop if _merge==1
(96 observations deleted)

. drop _merge

. drop if gwf_fail==.
(0 observations deleted)

. recode leaderexit exitsum (.=0) (.=0)
(leaderexit: 5946 changes made)
(exitsum: 5946 changes made)

. 
. 
. *Autocracy transition*
. gen gwf_AA = gwf_fail==1 & gwf_next~="democracy" & gwf_next~="provisional"  & gwf_non~
> ="democracy" & gwf_non~="provisional"

. *Transition to Democracy*
. gen gwf_AD = gwf_fail==1 & (gwf_next=="democracy" | gwf_next=="provisional")

. *Democratic Failure*
. gen gwf_DA = gwf_fail==1 & (gwf_next~="democracy" & gwf_next~="provisional")  & (gwf_n
> on=="democracy" | gwf_non=="provisional")

. 
. tab gwf_fail gwf_AA

           |        gwf_AA
  gwf_fail |         0          1 |     Total
-----------+----------------------+----------
         0 |     6,739          0 |     6,739 
         1 |       194        123 |       317 
-----------+----------------------+----------
     Total |     6,933        123 |     7,056 


. tab gwf_fail gwf_AD

           |        gwf_AD
  gwf_fail |         0          1 |     Total
-----------+----------------------+----------
         0 |     6,739          0 |     6,739 
         1 |       199        118 |       317 
-----------+----------------------+----------
     Total |     6,938        118 |     7,056 


. tab gwf_fail gwf_DA

           |        gwf_DA
  gwf_fail |         0          1 |     Total
-----------+----------------------+----------
         0 |     6,739          0 |     6,739 
         1 |       241         76 |       317 
-----------+----------------------+----------
     Total |     6,980         76 |     7,056 


. 
. 
. tab exitsum gwf_AA if gwf_regimetype~="NA" 

           |        gwf_AA
   exitsum |         0          1 |     Total
-----------+----------------------+----------
         0 |     3,826          6 |     3,832 
         1 |       237         82 |       319 
         2 |        47         20 |        67 
         3 |        11          5 |        16 
         4 |         1          1 |         2 
         5 |         0          1 |         1 
-----------+----------------------+----------
     Total |     4,122        115 |     4,237 


. tab exitsum gwf_AD if gwf_regimetype~="NA"

           |        gwf_AD
   exitsum |         0          1 |     Total
-----------+----------------------+----------
         0 |     3,818         14 |     3,832 
         1 |       262         57 |       319 
         2 |        46         21 |        67 
         3 |        11          5 |        16 
         4 |         1          1 |         2 
         5 |         1          0 |         1 
-----------+----------------------+----------
     Total |     4,139         98 |     4,237 


. tab exitsum gwf_DA if (gwf_non=="democracy" | gwf_non=="provisional")

           |        gwf_DA
   exitsum |         0          1 |     Total
-----------+----------------------+----------
         0 |     2,008         23 |     2,031 
         1 |       561         35 |       596 
         2 |        53         12 |        65 
         3 |         9          5 |        14 
         4 |         5          0 |         5 
         7 |         0          1 |         1 
-----------+----------------------+----------
     Total |     2,636         76 |     2,712 


. 
. ** Fix (4) inauguration date differences **
.                 *Panama 1990; Chile 1990; Uruguay 1985; South Korea 1988 
. gen gwffail = gwf_fail

. recode gwffail (0=1) if ((cowc==95 & year==1990) | (cowc==155 & year==1990) | (cowc==1
> 65 & year==1985) | (cowc==732 & year==1988)  )
(gwffail: 4 changes made)

. recode gwf_AD (0=1) if  ((cowc==95 & year==1990) | (cowc==155 & year==1990) | (cowc==1
> 65 & year==1985) | (cowc==732 & year==1988)  )
(gwf_AD: 4 changes made)

. recode gwf_AD (1=0) if  ((cowc==95 & year==1989) | (cowc==155 & year==1989) | (cowc==1
> 65 & year==1984) | (cowc==732 & year==1987)  )
(gwf_AD: 4 changes made)

. 
. **leader failure years when NO regime collapse**
. tab leaderexit if gwffail==0 & gwf_regimetype~="NA"   & leaderexit>=1

 leaderexit |      Freq.     Percent        Cum.
------------+-----------------------------------
          1 |        212      100.00      100.00
------------+-----------------------------------
      Total |        212      100.00

. tab leaderexit if gwffail==0 & (gwf_non=="democracy" | gwf_non=="provisional")  & lead
> erexit>=1

 leaderexit |      Freq.     Percent        Cum.
------------+-----------------------------------
          1 |        610      100.00      100.00
------------+-----------------------------------
      Total |        610      100.00

. 
. **leader failure years when YES regime collapse**
. tab leaderexit if gwffail==1 & gwf_AA==1 & gwf_regimetype~="NA" & leaderexit>=1

 leaderexit |      Freq.     Percent        Cum.
------------+-----------------------------------
          1 |        109      100.00      100.00
------------+-----------------------------------
      Total |        109      100.00

. tab leaderexit if gwffail==1 & gwf_AD==1 & gwf_regimetype~="NA" & leaderexit>=1

 leaderexit |      Freq.     Percent        Cum.
------------+-----------------------------------
          1 |         84      100.00      100.00
------------+-----------------------------------
      Total |         84      100.00

. tab leaderexit if gwffail==1 & gwf_DA==1 & (gwf_non=="democracy" | gwf_non=="provision
> al") & leaderexit>=1

 leaderexit |      Freq.     Percent        Cum.
------------+-----------------------------------
          1 |         53      100.00      100.00
------------+-----------------------------------
      Total |         53      100.00

. 
. 
. gen graphgwfarchigos = .
(7,056 missing values generated)

. replace graphgwfarchigos = 610 in 1    /* Democracy survives */
(1 real change made)

. replace graphgwfarchigos = . in 2    
(0 real changes made)

. replace graphgwfarchigos = 53 in 3     /* Democracy-Autocracy */
(1 real change made)

. replace graphgwfarchigos = . in 4    
(0 real changes made)

. replace graphgwfarchigos = 84 in 5     /* Autocracy-Democracy */
(1 real change made)

. replace graphgwfarchigos = . in 6  
(0 real changes made)

. replace graphgwfarchigos = 109 in 7    /* Autocracy-Autocracy */
(1 real change made)

. replace graphgwfarchigos = . in 8  
(0 real changes made)

. replace graphgwfarchigos = 212 in 9    /* Autocracy survives */
(1 real change made)

. 
. gen index  = _n in 1/9
(7,047 missing values generated)

. label define allfails  1 "Democracy survives" 2 " "  3 "Democracy-Autocracy"  4 " " 5 
> "Autocracy-Democracy" /*
> */ 6 " " 7 "Autocracy-Autocracy" 8 " "  9 "Autocracy survives"   

. label values index  allfails 

. 
. twoway (bar graphgwfarchigos index, scheme(lean2)  ylabel(0(200)600,glcolor(gs14))   /
> *
> */ xlabel(1(1)9, valuelabel labsize(small) labcolor(black) labgap(tiny) noticks) xsize
> (10) ysize(5) )/*
> */ (scatter graphgwfarchigos index, ms(none) mla(graphgwfarchigos) mlabpos(6) graphreg
> ion(color(white)) /*
> */ xtitle("Type of event",height(8)) ytitle("Number of country-years")  xscale(range (
> 0 10))  /*
> */ legend(pos(12) col(1) ring(1) label(1 "Archigos Leader Failure") label(2 "") bmargi
> n(0) order(2 1)) )
(note:  named style 0 not found in class margin, default attributes used)

. *graph export "C:\Users\jwright\Documents\My Dropbox\Research\Autocratic Instability\A
> rchigosGWF.pdf", as(pdf) replace
. 
. ***********************************************************
. ** Archigos Irregular transitions vs. GWF regime failure **
. ***********************************************************
. use archigos_original, clear
(Archigos 2.9: A Data Set of Political Leaders)

. gen startyr = ""                                                        /*generate an 
> empty string variable*/
(3,042 missing values generated)

. replace startyr = substr(startdate,-4,4)                                /*capture last
>  4 characters of string var*/
variable startyr was str1 now str4
(3,042 real changes made)

. gen endyr = ""
(3,042 missing values generated)

. replace endyr = substr(enddate,-4,4)
variable endyr was str1 now str4
(3,042 real changes made)

. destring startyr endyr, replace                                                 /*crea
> te integer variables from string variables*/
startyr has all characters numeric; replaced as int
endyr has all characters numeric; replaced as int

. sort ccode eindate

. gen IRR = exit==3 & entry[_n+1]==1 & ccode == ccode[_n+1]

. tab IRR

        IRR |      Freq.     Percent        Cum.
------------+-----------------------------------
          0 |      2,592       85.21       85.21
          1 |        450       14.79      100.00
------------+-----------------------------------
      Total |      3,042      100.00

. keep if endyr>1945 & IRR==1
(2,765 observations deleted)

. tab IRR

        IRR |      Freq.     Percent        Cum.
------------+-----------------------------------
          1 |        277      100.00      100.00
------------+-----------------------------------
      Total |        277      100.00

. sum endyr

    Variable |        Obs        Mean    Std. Dev.       Min        Max
-------------+---------------------------------------------------------
       endyr |        277    1972.047    14.21527       1946       2003

. keep ccode endyr leader idacr IRR  

. rename ccode cowcode

. rename endyr year

. egen IRRsum = sum(IRR), by(cowcode year)

. tab IRRsum

     IRRsum |      Freq.     Percent        Cum.
------------+-----------------------------------
          1 |        217       78.34       78.34
          2 |         42       15.16       93.50
          3 |         18        6.50      100.00
------------+-----------------------------------
      Total |        277      100.00

. 
. sort cowcode year

. merge cowcode year using GWFglobal
(note: you are using old merge syntax; see [D] merge for new syntax)
variables cowcode year do not uniquely identify observations in the master data
(note: variable cowcode was int, now float to accommodate using data's values)

. tab _merge

     _merge |      Freq.     Percent        Cum.
------------+-----------------------------------
          1 |         15        0.19        0.19
          2 |      7,724       96.54       96.73
          3 |        262        3.27      100.00
------------+-----------------------------------
      Total |      8,001      100.00

. *browse idacr cowcode year if _merge==1                                         /*Thes
> e are small countries not in GWF, except DRC 1960 which GWF code as not indep until 19
> 61*/
. drop if _merge==1
(15 observations deleted)

. gen gwf_dict = gwf_fail==1 & gwf_next~="democracy" & gwf_next~="provisional"  & gwf_re
> gimetype~="NA" 

. tab gwf_dict IRRsum if gwf_regimetype~="NA" , m

           |                   IRRsum
  gwf_dict |         1          2          3          . |     Total
-----------+--------------------------------------------+----------
         0 |        73         16          9      4,383 |     4,481 
         1 |        77         18          0         34 |       129 
-----------+--------------------------------------------+----------
     Total |       150         34          9      4,417 |     4,610 


. 
. **total years and irregular transitions with no GWF autocratic regime failure**
. tab gwf_dict IRRsum if gwf_fail==0 & gwf_regimetype~="NA" & gwf_dict==0 &  IRRsum~=.  
> /* 105 irregular exits is 73 country-years */

           |              IRRsum
  gwf_dict |         1          2          3 |     Total
-----------+---------------------------------+----------
         0 |        50         14          9 |        73 
-----------+---------------------------------+----------
     Total |        50         14          9 |        73 


. 
. browse gwf_case gwf_regime  idacr leader year IRRsum if IRRsum>=1 &  IRRsum~=. & gwf_d
> ict==0 & gwf_regimetype~="NA" & gwf_fail==0    

. tab gwf_regime IRRsum if gwf_fail==0 & gwf_regimetype~="NA"    /* 39 of 73 years are m
> ilitary rule; 54 of 105 events are under military rule*/

                      |              IRRsum
          Regime type |         1          2          3 |     Total
----------------------+---------------------------------+----------
             military |        17          4          3 |        24 
    military-personal |         3          2          0 |         5 
             monarchy |         4          2          0 |         6 
                party |         5          2          3 |        10 
       party-military |         7          0          0 |         7 
party-military-pers.. |         3          0          0 |         3 
       party-personal |         2          2          0 |         4 
             personal |         9          2          3 |        14 
----------------------+---------------------------------+----------
                Total |        50         14          9 |        73 


. 
. egen tag = tag(cow year) if gwf_fail~=.

. keep if tag==1
(33 observations deleted)

. tsset cow year
       panel variable:  cowcode (unbalanced)
        time variable:  year, 1946 to 2010, but with gaps
                delta:  1 unit

. sort cow year

. gen nextfail = F.gwf_fail==1

. browse gwf_case gwf_regime  idacr leader IRRsum year nextfail if IRRsum>=1 &  IRRsum~=
> . & gwf_dict==0 & gwf_regimetype~="NA" & gwf_fail==0  

. tab nextfail if IRRsum>=1 &  IRRsum~=. & gwf_dict==0 & gwf_regimetype~="NA" & gwf_fail
> ==0 

   nextfail |      Freq.     Percent        Cum.
------------+-----------------------------------
          0 |         52       86.67       86.67
          1 |          8       13.33      100.00
------------+-----------------------------------
      Total |         60      100.00

. 
. **total years and irregular transitions with no GWF autocratic regime failure and NO r
> egime failure the next year either**
. tab IRRsum if nextfail==0 & gwf_dict==0 & gwf_regimetype~="NA" & gwf_fail==0 

     IRRsum |      Freq.     Percent        Cum.
------------+-----------------------------------
          1 |         44       84.62       84.62
          2 |          6       11.54       96.15
          3 |          2        3.85      100.00
------------+-----------------------------------
      Total |         52      100.00

. 
. ****************************************
. ** BDM and Smith 2010 AJPS, Model 2.2 **
. ****************************************
. 
. *Replication of Model 2.2
. use BdmSmithAJPS, clear

. qui streg W S age Wage threat3 Wthreat NTgdp WNTgdp lGDPpcWB WlGDPpcWB  growthWB Wgrow
> thWB , dis(wei) anc(W ) cluster(ccode)

. lincom NTgdp

 ( 1)  [_t]NTgdp = 0

------------------------------------------------------------------------------
          _t |      Coef.   Std. Err.      z    P>|z|     [95% Conf. Interval]
-------------+----------------------------------------------------------------
         (1) |  -.0600965   .0265881    -2.26   0.024    -.1122082   -.0079848
------------------------------------------------------------------------------

. lincom WNTgdp + NTgdp

 ( 1)  [_t]NTgdp + [_t]WNTgdp = 0

------------------------------------------------------------------------------
          _t |      Coef.   Std. Err.      z    P>|z|     [95% Conf. Interval]
-------------+----------------------------------------------------------------
         (1) |   .0206928   .0201893     1.02   0.305    -.0188776    .0602631
------------------------------------------------------------------------------

. 
. rename ccode cowcode

. sort cowcode year

. merge cowcode year using GWFglobal
(note: you are using old merge syntax; see [D] merge for new syntax)
variables cowcode year do not uniquely identify observations in the master data
(note: variable cowcode was int, now float to accommodate using data's values)

. tab _merge

     _merge |      Freq.     Percent        Cum.
------------+-----------------------------------
          1 |     17,857       65.69       65.69
          2 |        327        1.20       66.89
          3 |      9,000       33.11      100.00
------------+-----------------------------------
      Total |     27,184      100.00

. gen fail1 = _d
(11,749 missing values generated)

. rename _d bdm_d

. rename _t bdm_t

. rename _t0 bdm_t0

. stset  bdm_t, fail(fail1) id(ID)

                id:  ID
     failure event:  fail1 != 0 & fail1 < .
obs. time interval:  (bdm_t[_n-1], bdm_t]
 exit on or before:  failure

------------------------------------------------------------------------------
      27184  total observations
      11738  ignored because ID missing
         11  event time missing (bdm_t>=.)                      PROBABLE ERROR
------------------------------------------------------------------------------
      15435  observations remaining, representing
       3019  subjects
       2773  failures in single-failure-per-subject data
  12629.555  total analysis time at risk and under observation
                                                at risk from t =         0
                                     earliest observed entry t =         0
                                          last observed exit t =  67.96715

. corr bdm* _d _t _t0
(obs=15,435)

             |    bdm_d    bdm_t   bdm_t0       _d       _t      _t0
-------------+------------------------------------------------------
       bdm_d |   1.0000
       bdm_t |  -0.1608   1.0000
      bdm_t0 |  -0.1430   0.9993   1.0000
          _d |   1.0000  -0.1608  -0.1430   1.0000
          _t |  -0.1608   1.0000   0.9993  -0.1608   1.0000
         _t0 |  -0.1430   0.9993   1.0000  -0.1430   0.9993   1.0000


. 
. *Replication model*
. stset  bdm_t, fail(fail1) id(ID)

                id:  ID
     failure event:  fail1 != 0 & fail1 < .
obs. time interval:  (bdm_t[_n-1], bdm_t]
 exit on or before:  failure

------------------------------------------------------------------------------
      27184  total observations
      11738  ignored because ID missing
         11  event time missing (bdm_t>=.)                      PROBABLE ERROR
------------------------------------------------------------------------------
      15435  observations remaining, representing
       3019  subjects
       2773  failures in single-failure-per-subject data
  12629.555  total analysis time at risk and under observation
                                                at risk from t =         0
                                     earliest observed entry t =         0
                                          last observed exit t =  67.96715

. qui streg W S age Wage threat3 Wthreat NTgdp WNTgdp lGDPpcWB WlGDPpcWB  growthWB Wgrow
> thWB , dis(wei) anc(W ) cluster(ccode)

. estimates store r1

. lincom NTgdp

 ( 1)  [_t]NTgdp = 0

------------------------------------------------------------------------------
          _t |      Coef.   Std. Err.      z    P>|z|     [95% Conf. Interval]
-------------+----------------------------------------------------------------
         (1) |  -.0600965   .0247114    -2.43   0.015    -.1085299   -.0116631
------------------------------------------------------------------------------

. lincom WNTgdp + NTgdp

 ( 1)  [_t]NTgdp + [_t]WNTgdp = 0

------------------------------------------------------------------------------
          _t |      Coef.   Std. Err.      z    P>|z|     [95% Conf. Interval]
-------------+----------------------------------------------------------------
         (1) |   .0206928   .0166032     1.25   0.213    -.0118489    .0532344
------------------------------------------------------------------------------

. 
. 
. *Failure types*
. gen fail2 = fail1==1 & gwf_fail==1 if fail1~=.
(11,749 missing values generated)

. gen fail3 = fail1==1 & (gwf_fail==0 | gwf_fail==.) if fail1~=.
(11,749 missing values generated)

. *Five leader failures in sample take place the calendar year after the electoral/demon
> stration event that ends the regime:
.         *Panama 1990; Chile 1990; Uruguay 1985; South Korea 1988; Indonesia 1998
. recode fail2 (0=1) if fail1==1 & ((cowc==95 & year==1990) | (cowc==155 & year==1990) |
>  (cowc==165 & year==1985) | (cowc==732 & year==1988) | (cowc==850 & year==1998))
(fail2: 5 changes made)

. recode fail3 (1=0) if (cowc==95 & year==1990) | (cowc==155 & year==1990) | (cowc==165 
> & year==1985) | (cowc==732 & year==1988) | (cowc==850 & year==1998)  
(fail3: 5 changes made)

. 
. sum bdm_d _d fail* if e(sample)

    Variable |        Obs        Mean    Std. Dev.       Min        Max
-------------+---------------------------------------------------------
       bdm_d |      2,105    .1591449    .3658981          0          1
          _d |      2,105    .1591449    .3658981          0          1
        fail |      2,105    .1686461     .374528          0          1
       fail1 |      2,105    .1591449    .3658981          0          1
       fail2 |      2,105    .0213777    .1446742          0          1
-------------+---------------------------------------------------------
       fail3 |      2,105    .1377672    .3447374          0          1

. tab fail1 fail2 if e(sample)

           |         fail2
     fail1 |         0          1 |     Total
-----------+----------------------+----------
         0 |     1,770          0 |     1,770 
         1 |       290         45 |       335 
-----------+----------------------+----------
     Total |     2,060         45 |     2,105 


. tab fail1 fail3 if e(sample)

           |         fail3
     fail1 |         0          1 |     Total
-----------+----------------------+----------
         0 |     1,770          0 |     1,770 
         1 |        45        290 |       335 
-----------+----------------------+----------
     Total |     1,815        290 |     2,105 


. 
. drop _merge

. saveold temp_BDM, replace
(saving in Stata 13 format)
(FYI, saveold has options version(12) and version(11) that write files in older Stata
      formats)
file temp_BDM.dta saved

. 
. 
. 
. **DV's for Appendix Table*
. sort country year

. browse country year if e(sample) & fail2==1

. browse country year if e(sample) & fail3==1

. 
. *Only regime failures*
. stset  bdm_t, fail(fail2) id(ID)

                id:  ID
     failure event:  fail2 != 0 & fail2 < .
obs. time interval:  (bdm_t[_n-1], bdm_t]
 exit on or before:  failure

------------------------------------------------------------------------------
      27184  total observations
      11738  ignored because ID missing
         11  event time missing (bdm_t>=.)                      PROBABLE ERROR
------------------------------------------------------------------------------
      15435  observations remaining, representing
       3019  subjects
        374  failures in single-failure-per-subject data
  12629.555  total analysis time at risk and under observation
                                                at risk from t =         0
                                     earliest observed entry t =         0
                                          last observed exit t =  67.96715

. tab _d fail2 if e(sample)

      1 if |
failure; 0 |
        if |         fail2
  censored |         0          1 |     Total
-----------+----------------------+----------
         0 |     2,060          0 |     2,060 
         1 |         0         45 |        45 
-----------+----------------------+----------
     Total |     2,060         45 |     2,105 


. qui streg W S age Wage threat3 Wthreat NTgdp WNTgdp lGDPpcWB WlGDPpcWB  growthWB Wgrow
> thWB , dis(wei) anc(W ) cluster(cowcode)

. estimates store r2

. lincom NTgdp

 ( 1)  [_t]NTgdp = 0

------------------------------------------------------------------------------
          _t |      Coef.   Std. Err.      z    P>|z|     [95% Conf. Interval]
-------------+----------------------------------------------------------------
         (1) |  -.0199403   .0374631    -0.53   0.595    -.0933666    .0534859
------------------------------------------------------------------------------

. lincom WNTgdp  + NTgdp

 ( 1)  [_t]NTgdp + [_t]WNTgdp = 0

------------------------------------------------------------------------------
          _t |      Coef.   Std. Err.      z    P>|z|     [95% Conf. Interval]
-------------+----------------------------------------------------------------
         (1) |  -.0013501    .067883    -0.02   0.984    -.1343983    .1316982
------------------------------------------------------------------------------

. 
. *Only non-regime failures*
. stset  bdm_t, fail(fail3) id(ID)

                id:  ID
     failure event:  fail3 != 0 & fail3 < .
obs. time interval:  (bdm_t[_n-1], bdm_t]
 exit on or before:  failure

------------------------------------------------------------------------------
      27184  total observations
      11738  ignored because ID missing
         11  event time missing (bdm_t>=.)                      PROBABLE ERROR
------------------------------------------------------------------------------
      15435  observations remaining, representing
       3019  subjects
       2399  failures in single-failure-per-subject data
  12629.555  total analysis time at risk and under observation
                                                at risk from t =         0
                                     earliest observed entry t =         0
                                          last observed exit t =  67.96715

. tab _d fail3 if e(sample)

      1 if |
failure; 0 |
        if |         fail3
  censored |         0          1 |     Total
-----------+----------------------+----------
         0 |     1,815          0 |     1,815 
         1 |         0        290 |       290 
-----------+----------------------+----------
     Total |     1,815        290 |     2,105 


. qui streg W S age Wage threat3 Wthreat NTgdp WNTgdp lGDPpcWB WlGDPpcWB  growthWB Wgrow
> thWB , dis(wei) anc(W ) cluster(cowcode)

. estimates store r3

. lincom NTgdp

 ( 1)  [_t]NTgdp = 0

------------------------------------------------------------------------------
          _t |      Coef.   Std. Err.      z    P>|z|     [95% Conf. Interval]
-------------+----------------------------------------------------------------
         (1) |  -.0725679   .0267046    -2.72   0.007     -.124908   -.0202279
------------------------------------------------------------------------------

. lincom WNTgdp + NTgdp

 ( 1)  [_t]NTgdp + [_t]WNTgdp = 0

------------------------------------------------------------------------------
          _t |      Coef.   Std. Err.      z    P>|z|     [95% Conf. Interval]
-------------+----------------------------------------------------------------
         (1) |   .0227429    .021344     1.07   0.287    -.0190905    .0645763
------------------------------------------------------------------------------

. 
. estout  r1 r2 r3 using Table2.tex, cells(b(star  fmt(%9.3f)) se(par fmt(%9.2f))) stats
> (ll r2 N) style(tex) replace label starlevels(* 0.10 ** 0.05)
(output written to Table2.tex)

. 
. 
. **Multinomial setting**
. gen tme = bdm_t+1
(11,749 missing values generated)

. gen duration = round(tme,1)
(11,749 missing values generated)

. drop tme

. sum duration

    Variable |        Obs        Mean    Std. Dev.       Min        Max
-------------+---------------------------------------------------------
    duration |     15,435    7.465695    8.197149          1         69

. gen duration2= duration^2
(11,749 missing values generated)

. gen duration3 = duration^3
(11,749 missing values generated)

. gen fail_all = fail1
(11,749 missing values generated)

. /* fail_all==1 is regime collapse failure; fail_all==-1 is no regime collapse failure*
> /
. recode fail_all (1=-1) if fail1==1 & fail3==1  
(fail_all: 2399 changes made)

. mlogit fail_all duration* W S age Wage threat3 Wthreat NTgdp WNTgdp lGDPpcWB WlGDPpcWB
>   growthWB WgrowthWB,  cluster(cowcode)

Iteration 0:   log pseudolikelihood =  -1054.683  
Iteration 1:   log pseudolikelihood = -1052.4968  
Iteration 2:   log pseudolikelihood = -971.03937  
Iteration 3:   log pseudolikelihood = -948.47598  
Iteration 4:   log pseudolikelihood = -941.29259  
Iteration 5:   log pseudolikelihood =  -941.1751  
Iteration 6:   log pseudolikelihood = -941.17498  
Iteration 7:   log pseudolikelihood = -941.17498  

Multinomial logistic regression                 Number of obs     =      2,105
                                                Wald chi2(30)     =     321.17
                                                Prob > chi2       =     0.0000
Log pseudolikelihood = -941.17498               Pseudo R2         =     0.1076

                              (Std. Err. adjusted for 103 clusters in cowcode)
------------------------------------------------------------------------------
             |               Robust
    fail_all |      Coef.   Std. Err.      z    P>|z|     [95% Conf. Interval]
-------------+----------------------------------------------------------------
-1           |
    duration |   .1026678   .0957511     1.07   0.284    -.0850009    .2903364
   duration2 |  -.0176683   .0077884    -2.27   0.023    -.0329334   -.0024032
   duration3 |   .0004359   .0001626     2.68   0.007     .0001172    .0007546
           W |   1.318023   1.903315     0.69   0.489    -2.412406    5.048453
           S |  -1.145563   .3982159    -2.88   0.004    -1.926052   -.3650747
         age |  -.0137662   .0204729    -0.67   0.501    -.0538925      .02636
        Wage |   .0549388   .0243725     2.25   0.024     .0071695    .1027081
     threat3 |   .0628348   .2150782     0.29   0.770    -.3587107    .4843802
     Wthreat |  -.0450779   .2641685    -0.17   0.865    -.5628387    .4726829
       NTgdp |   -.062413   .0281311    -2.22   0.027     -.117549    -.007277
      WNTgdp |   .0740766   .0452203     1.64   0.101    -.0145535    .1627066
    lGDPpcWB |   .3716548   .1683539     2.21   0.027     .0416873    .7016224
   WlGDPpcWB |  -.3754438   .2489673    -1.51   0.132    -.8634109    .1125232
    growthWB |  -.0243575   .0312975    -0.78   0.436    -.0856994    .0369844
   WgrowthWB |  -.0459479   .0499321    -0.92   0.357     -.143813    .0519172
       _cons |  -3.748311   1.199705    -3.12   0.002     -6.09969   -1.396932
-------------+----------------------------------------------------------------
0            |  (base outcome)
-------------+----------------------------------------------------------------
1            |
    duration |   .0327086    .179171     0.18   0.855    -.3184601    .3838773
   duration2 |   -.005994   .0134481    -0.45   0.656    -.0323517    .0203637
   duration3 |   .0001202   .0002952     0.41   0.684    -.0004584    .0006988
           W |   4.330033   3.009078     1.44   0.150    -1.567652    10.22772
           S |  -1.811615   .6154156    -2.94   0.003    -3.017808    -.605423
         age |   .1234265   .0356635     3.46   0.001     .0535273    .1933257
        Wage |  -.1284977   .0498838    -2.58   0.010    -.2262681   -.0307273
     threat3 |   .3792593   .1506509     2.52   0.012     .0839888    .6745297
     Wthreat |   .0370196   .4921532     0.08   0.940     -.927583    1.001622
       NTgdp |  -.0192206   .0317669    -0.61   0.545    -.0814827    .0430414
      WNTgdp |   .0184982   .0802888     0.23   0.818     -.138865    .1758614
    lGDPpcWB |  -.8556658   .2480919    -3.45   0.001    -1.341917   -.3694147
   WlGDPpcWB |   .4394333   .3242008     1.36   0.175    -.1959885    1.074855
    growthWB |  -.1006712   .0381596    -2.64   0.008    -.1754627   -.0258798
   WgrowthWB |   .1383299   .0950137     1.46   0.145    -.0478936    .3245534
       _cons |  -3.029429   1.593682    -1.90   0.057    -6.152988    .0941303
------------------------------------------------------------------------------

. 
. 
. ***Hazards***
. 
.         stset  bdm_t, fail(fail1) id(ID)

                id:  ID
     failure event:  fail1 != 0 & fail1 < .
obs. time interval:  (bdm_t[_n-1], bdm_t]
 exit on or before:  failure

------------------------------------------------------------------------------
      27184  total observations
      11738  ignored because ID missing
         11  event time missing (bdm_t>=.)                      PROBABLE ERROR
------------------------------------------------------------------------------
      15435  observations remaining, representing
       3019  subjects
       2773  failures in single-failure-per-subject data
  12629.555  total analysis time at risk and under observation
                                                at risk from t =         0
                                     earliest observed entry t =         0
                                          last observed exit t =  67.96715

.         qui streg W S age Wage threat3 Wthreat NTgdp WNTgdp lGDPpcWB WlGDPpcWB  growth
> WB WgrowthWB , dis(wei) cluster(ccode)

.         lincom NTgdp

 ( 1)  [_t]NTgdp = 0

------------------------------------------------------------------------------
          _t |      Coef.   Std. Err.      z    P>|z|     [95% Conf. Interval]
-------------+----------------------------------------------------------------
         (1) |  -.0739612   .0251117    -2.95   0.003    -.1231792   -.0247433
------------------------------------------------------------------------------

.         lincom WNTgdp + NTgdp

 ( 1)  [_t]NTgdp + [_t]WNTgdp = 0

------------------------------------------------------------------------------
          _t |      Coef.   Std. Err.      z    P>|z|     [95% Conf. Interval]
-------------+----------------------------------------------------------------
         (1) |   .0203457    .016014     1.27   0.204    -.0110413    .0517326
------------------------------------------------------------------------------

.         stcurve, hazard at1(NTgdp=3, WNTgdp=0, W=0) at2(NTgdp=13, WNTgdp=0, W=0) /*
>         */  legend(pos(12) col(2) ring(1) label(1 "Non-tax= 3%") label(2 "Non-tax= 13%
> "))/*
>         */ yscale(range (0 0.1)) xscale(range (0 12)) xlabel(0 (2) 12)  range(0 12) 

.         *graph export "C:\Users\jwright\Documents\My Dropbox\Research\Autocratic Insta
> bility\BDMSmithRep1.pdf", as(pdf)                            replace
. 
.         stset  bdm_t, fail(fail2) id(ID)

                id:  ID
     failure event:  fail2 != 0 & fail2 < .
obs. time interval:  (bdm_t[_n-1], bdm_t]
 exit on or before:  failure

------------------------------------------------------------------------------
      27184  total observations
      11738  ignored because ID missing
         11  event time missing (bdm_t>=.)                      PROBABLE ERROR
------------------------------------------------------------------------------
      15435  observations remaining, representing
       3019  subjects
        374  failures in single-failure-per-subject data
  12629.555  total analysis time at risk and under observation
                                                at risk from t =         0
                                     earliest observed entry t =         0
                                          last observed exit t =  67.96715

.         qui streg W S age Wage threat3 Wthreat NTgdp WNTgdp lGDPpcWB WlGDPpcWB  growth
> WB WgrowthWB , dis(wei) cluster(ccode)

.         lincom NTgdp

 ( 1)  [_t]NTgdp = 0

------------------------------------------------------------------------------
          _t |      Coef.   Std. Err.      z    P>|z|     [95% Conf. Interval]
-------------+----------------------------------------------------------------
         (1) |  -.0168476   .0474229    -0.36   0.722    -.1097948    .0760996
------------------------------------------------------------------------------

.         lincom WNTgdp + NTgdp

 ( 1)  [_t]NTgdp + [_t]WNTgdp = 0

------------------------------------------------------------------------------
          _t |      Coef.   Std. Err.      z    P>|z|     [95% Conf. Interval]
-------------+----------------------------------------------------------------
         (1) |  -.0026953   .0739494    -0.04   0.971    -.1476334    .1422428
------------------------------------------------------------------------------

.         stcurve, hazard at1(NTgdp=3, WNTgdp=0, W=0) at2(NTgdp=13, WNTgdp=0, W=0) /*
>         */  legend(pos(12) col(2) ring(1) label(1 "Non-tax= 3%") label(2 "Non-tax= 13%
> "))/*
>         */ yscale(range (0 0.002)) ylabel(0 (0.0005) 0.002) xscale(range (0 12)) xlabe
> l(0 (2) 12)  range(0 12) 

.         *graph export "C:\Users\jwright\Documents\My Dropbox\Research\Autocratic Insta
> bility\BDMSmithRep2.pdf", as(pdf)                            replace
. 
.         stset  bdm_t, fail(fail3) id(ID)

                id:  ID
     failure event:  fail3 != 0 & fail3 < .
obs. time interval:  (bdm_t[_n-1], bdm_t]
 exit on or before:  failure

------------------------------------------------------------------------------
      27184  total observations
      11738  ignored because ID missing
         11  event time missing (bdm_t>=.)                      PROBABLE ERROR
------------------------------------------------------------------------------
      15435  observations remaining, representing
       3019  subjects
       2399  failures in single-failure-per-subject data
  12629.555  total analysis time at risk and under observation
                                                at risk from t =         0
                                     earliest observed entry t =         0
                                          last observed exit t =  67.96715

.         qui streg W S age Wage threat3 Wthreat NTgdp WNTgdp lGDPpcWB WlGDPpcWB  growth
> WB WgrowthWB , dis(wei) cluster(ccode)

.         lincom NTgdp

 ( 1)  [_t]NTgdp = 0

------------------------------------------------------------------------------
          _t |      Coef.   Std. Err.      z    P>|z|     [95% Conf. Interval]
-------------+----------------------------------------------------------------
         (1) |  -.0880087    .024197    -3.64   0.000     -.135434   -.0405834
------------------------------------------------------------------------------

.         lincom WNTgdp + NTgdp

 ( 1)  [_t]NTgdp + [_t]WNTgdp = 0

------------------------------------------------------------------------------
          _t |      Coef.   Std. Err.      z    P>|z|     [95% Conf. Interval]
-------------+----------------------------------------------------------------
         (1) |   .0217776   .0160996     1.35   0.176     -.009777    .0533322
------------------------------------------------------------------------------

.         stcurve, hazard at1(NTgdp=3, WNTgdp=0, W=0) at2(NTgdp=13, WNTgdp=0, W=0) /*
>         */  legend(pos(12) col(2) ring(1) label(1 "Non-tax= 3%") label(2 "Non-tax= 13%
> "))/*
>         */ yscale(range (0 0.04)) ylabel(0 (0.005) 0.04) xscale(range (0 12)) xlabel(0
>  (2) 12)  range(0 12) 

.         *graph export "C:\Users\jwright\Documents\My Dropbox\Research\Autocratic Insta
> bility\BDMSmithRep3.pdf", as(pdf)                            replace
. 
. 
. ******The End******
. 
end of do-file

. 
. do DPI

. ** Graph comparing DPI and GWF
. 
. use DPI2012, clear
(Database of Political Institutions 2012. Philip Keefer, World Bank)

. keep  countryname ifs year yrsoffc finittrm yrcurnt

. gen cowcode = .
(6,764 missing values generated)

. rename country country

. do cowcodes

. replace cowcode= 700 if country=="Afghanistan"
(38 real changes made)

. replace cowcode= 339 if country=="Albania"
(38 real changes made)

. replace cowcode= 615 if country=="Algeria"
(38 real changes made)

. replace cowcode= 232 if country=="Andorra"
(0 real changes made)

. replace cowcode= 540 if country=="Angola"
(38 real changes made)

. replace cowcode= 58 if country=="Antigua and Barbuda"
(0 real changes made)

. replace cowcode= 58 if country=="Antigua & Barbuda"
(0 real changes made)

. replace cowcode= 160 if country=="Argentina"
(38 real changes made)

. replace cowcode= 371 if country=="Armenia"
(38 real changes made)

. replace cowcode= 900 if country=="Australia"
(38 real changes made)

. replace cowcode= 305 if country=="Austria"
(38 real changes made)

. replace cowcode= 373 if country=="Azerbaijan"
(38 real changes made)

. replace cowcode= 31 if country=="Bahamas"
(38 real changes made)

. replace cowcode= 31 if country=="Bahamas, The"
(0 real changes made)

. replace cowcode= 692 if country=="Bahrain"
(38 real changes made)

. replace cowcode= 771 if country=="Bangladesh"
(38 real changes made)

. replace cowcode= 53 if country=="Barbados"
(38 real changes made)

. replace cowcode= 370 if country=="Belarus"
(38 real changes made)

. replace cowcode= 211 if country=="Belgium"
(38 real changes made)

. replace cowcode= 211 if country=="Belgium-Luxembourg"
(0 real changes made)

. replace cowcode= 80 if country=="Belize"
(38 real changes made)

. replace cowcode= 434 if country=="Benin"
(38 real changes made)

. replace cowcode= 434 if country=="Dahomey"
(0 real changes made)

. replace cowcode= 760 if country=="Bhutan"
(38 real changes made)

. replace cowcode= 145 if country=="Bolivia"
(38 real changes made)

. replace cowcode= 346 if country=="Bosnia"
(0 real changes made)

. replace cowcode= 346 if country=="Bosnia and Herzegovina"
(0 real changes made)

. replace cowcode= 346 if country=="Bosnia & Herzegovina"
(0 real changes made)

. replace cowcode= 346 if country=="Bosnia-Herzegovina"
(0 real changes made)

. replace cowcode= 571 if country=="Botswana"
(38 real changes made)

. replace cowcode= 140 if country=="Brazil"
(38 real changes made)

. replace cowcode= 835 if country=="Brunei"
(38 real changes made)

. replace cowcode= 835 if country=="Brunei Darussalam"
(0 real changes made)

. replace cowcode= 355 if country=="Bulgaria"
(38 real changes made)

. replace cowcode= 439 if country=="Burkina Faso"
(38 real changes made)

. replace cowcode= 439 if country=="Upper Volta"
(0 real changes made)

. replace cowcode= 516 if country=="Burundi"
(38 real changes made)

. replace cowcode= 811 if country=="Cambodia"
(38 real changes made)

. replace cowcode= 811 if country=="Kampuchea"
(0 real changes made)

. replace cowcode= 811 if country=="Khmer Rep"
(0 real changes made)

. replace cowcode= 471 if country=="Cameroon"
(38 real changes made)

. replace cowcode= 20 if country=="Canada"
(38 real changes made)

. replace cowcode= 402 if country=="Cape Verde"
(0 real changes made)

. replace cowcode= 402 if country=="Cape Verde Island"
(0 real changes made)

. replace cowcode= 482 if country=="Cen African Rep"
(0 real changes made)

. replace cowcode= 482 if country=="Central African Republic"
(0 real changes made)

. replace cowcode= 482 if country=="Central African Rep."
(0 real changes made)

. replace cowcode= 482 if country=="Central African Rep"
(0 real changes made)

. replace cowcode= 483 if country=="Chad"
(38 real changes made)

. replace cowcode= 155 if country=="Chile"
(38 real changes made)

. replace cowcode= 710 if country=="China"
(0 real changes made)

. replace cowcode= 100 if country=="Colombia"
(38 real changes made)

. replace cowcode = 581 if country == "Comoros"
(0 real changes made)

. replace cowcode = 581 if country == "Comoro Is."
(38 real changes made)

. replace cowcode = 581 if country == "Comoro Island"
(0 real changes made)

. replace cowcode= 484 if country=="Congo"
(38 real changes made)

. replace cowcode= 484 if country=="Congo-Brz"
(0 real changes made)

. replace cowcode= 484 if country== "Congo 'Brazzaville'"
(0 real changes made)

. replace cowcode= 484 if country== "Congo Brazzaville"
(0 real changes made)

. replace cowcode= 490 if country== "Congo DR"
(0 real changes made)

. replace cowcode= 490 if country== "Congo, DR"
(0 real changes made)

. replace cowcode= 490 if country== "Congo, Dem. Rep."
(0 real changes made)

. replace cowcode= 490 if country== "Dem. Rep. Congo"
(0 real changes made)

. replace cowcode= 490 if country== "Dem. Rep."
(0 real changes made)

. replace cowcode= 490 if country== "Congo, Democratic Republic of"
(0 real changes made)

. replace cowcode= 490 if country== "Congo, the Democratic Republic of the"
(0 real changes made)

. replace cowcode= 490 if country== "Congo Kinshasa"
(0 real changes made)

. replace cowcode= 484 if country== "Congo, Rep."
(0 real changes made)

. replace cowcode= 490 if country=="Congo/Zaire"
(0 real changes made)

. replace cowcode= 490 if country=="Zaire (Congo Kinshasa)"
(0 real changes made)

. replace cowcode= 490 if country=="Zaire"
(0 real changes made)

. replace cowcode= 94 if country=="Costa Rica"
(38 real changes made)

. replace cowcode= 94 if country=="Costarica"
(0 real changes made)

. replace cowcode= 437 if country=="Cote d'Ivoire"
(38 real changes made)

. replace cowcode= 437 if country=="Cote d`Ivoire"
(0 real changes made)

. replace cowcode= 437 if country=="C�te d'Ivoire"
(0 real changes made)

. replace cowcode= 437 if country=="Cote d Ivoire"
(0 real changes made)

. replace cowcode=437 if country=="C�te d'Ivoire"
(0 real changes made)

. replace cowcode= 344 if country=="Croatia"
(38 real changes made)

. replace cowcode= 40 if country=="Cuba"
(38 real changes made)

. replace cowcode= 352 if country=="Cyprus"
(38 real changes made)

. replace cowcode= 352 if country=="Turk Cyprus"
(38 real changes made)

. replace cowcode= 316 if country=="Czech Republic"
(0 real changes made)

. replace cowcode= 316 if country=="Czechrep"
(0 real changes made)

. replace cowcode= 315 if country=="Czechoslovakia"
(0 real changes made)

. replace cowcode= 390 if country=="Denmark"
(38 real changes made)

. replace cowcode= 522 if country=="Djibouti"
(38 real changes made)

. replace cowcode= 54 if country=="Dominica"
(0 real changes made)

. replace cowcode= 42 if country=="Dominican Rep"
(0 real changes made)

. replace cowcode= 42 if country=="Dominican Republic"
(0 real changes made)

. replace cowcode= 42 if country=="Dominican Rep."
(0 real changes made)

. replace cowcode= 130 if country=="Ecuador"
(38 real changes made)

. replace cowcode= 651 if country=="Egypt"
(38 real changes made)

. replace cowcode= 651 if country=="Egypt, Arab Rep."
(0 real changes made)

. replace cowcode= 92 if country=="El Salvador"
(38 real changes made)

. replace cowcode= 411 if country=="Equatorial Guinea"
(0 real changes made)

. replace cowcode= 531 if country=="Eritrea"
(38 real changes made)

. replace cowcode= 366 if country=="Estonia"
(38 real changes made)

. replace cowcode= 530 if country=="Ethiopia"
(38 real changes made)

. replace cowcode= 530 if country=="Ethiopia PDR"
(0 real changes made)

. replace cowcode= 950 if country=="Fiji"
(38 real changes made)

. replace cowcode= 375 if country=="Finland"
(38 real changes made)

. replace cowcode= 220 if country=="France"
(38 real changes made)

. replace cowcode= 481 if country=="Gabon"
(38 real changes made)

. replace cowcode= 420 if country=="Gambia"
(38 real changes made)

. replace cowcode= 420 if country=="Gambia, The"
(0 real changes made)

. replace cowcode= 372 if country=="Georgia"
(38 real changes made)

. replace cowcode= 255 if country=="Germany"
(0 real changes made)

. replace cowcode= 265 if country=="Germany East"
(0 real changes made)

. replace cowcode= 265 if country=="GDR"
(38 real changes made)

. replace cowcode= 265 if country=="German Dem. Rep."
(0 real changes made)

. replace cowcode= 265 if country=="German DR"
(0 real changes made)

. replace cowcode= 260 if country=="Germany West"
(0 real changes made)

. replace cowcode= 260 if country=="Germanyfed. Rep."
(0 real changes made)

. replace cowcode= 452 if country=="Ghana"
(38 real changes made)

. replace cowcode= 350 if country=="Greece"
(38 real changes made)

. replace cowcode= 55 if country=="Grenada"
(38 real changes made)

. replace cowcode= 90 if country=="Guatemala"
(38 real changes made)

. replace cowcode= 438 if country=="Guinea"
(38 real changes made)

. replace cowcode= 404 if country=="Guinea Bissau"
(0 real changes made)

. replace cowcode= 404 if country=="Guinea-Bissau"
(38 real changes made)

. replace cowcode= 110 if country=="Guyana"
(38 real changes made)

. replace cowcode= 41 if country=="Haiti"
(38 real changes made)

. replace cowcode= 91 if country=="Honduras"
(38 real changes made)

. replace cowcode= 310 if country=="Hungary"
(38 real changes made)

. replace cowcode= 395 if country=="Iceland"
(38 real changes made)

. replace cowcode= 750 if country=="India"
(38 real changes made)

. replace cowcode= 850 if country=="Indonesia"
(38 real changes made)

. replace cowcode= 630 if country=="Iran"
(38 real changes made)

. replace cowcode= 630 if country=="Iran, Islamic Republic of"
(0 real changes made)

. replace cowcode= 630 if country=="Iran, Islamic Rep."
(0 real changes made)

. replace cowcode= 645 if country=="Iraq"
(38 real changes made)

. replace cowcode= 205 if country=="Ireland"
(38 real changes made)

. replace cowcode= 666 if country=="Israel"
(38 real changes made)

. replace cowcode= 325 if country=="Italy"
(38 real changes made)

. replace cowcode= 437 if country=="Ivory Coast"
(0 real changes made)

. replace cowcode= 51 if country=="Jamaica"
(38 real changes made)

. replace cowcode= 740 if country=="Japan"
(38 real changes made)

. replace cowcode= 663 if country=="Jordan"
(38 real changes made)

. replace cowcode= 705 if country=="Kazakhstan"
(38 real changes made)

. replace cowcode= 501 if country=="Kenya"
(38 real changes made)

. replace cowcode= 946 if country=="Kiribati"
(0 real changes made)

. replace cowcode= 731 if country=="Korea North"
(0 real changes made)

. replace cowcode= 731 if country=="N. Korea"
(0 real changes made)

. replace cowcode= 731 if country=="North Korea"
(0 real changes made)

. replace cowcode= 731 if country=="Korea DPR"
(0 real changes made)

. replace cowcode= 731 if country=="Korea, Democratic People's Republic of"
(0 real changes made)

. replace cowcode= 731 if country=="Korea, Dem. Rep."
(0 real changes made)

. replace cowcode= 732 if country=="Korea South"
(0 real changes made)

. replace cowcode= 732 if country=="Korea, S."
(0 real changes made)

. replace cowcode= 732 if country=="South Korea"
(0 real changes made)

. replace cowcode= 732 if country=="Korea Rep"
(0 real changes made)

. replace cowcode= 732 if country=="Korea, Rep."
(0 real changes made)

. replace cowcode= 732 if country=="Korea, Republic of"
(0 real changes made)

. replace cowcode= 690 if country=="Kuwait"
(38 real changes made)

. replace cowcode= 703 if country=="Kyrgyz Republic"
(0 real changes made)

. replace cowcode= 703 if country=="Kyrgyzstan"
(38 real changes made)

. replace cowcode= 703 if country=="Kyrgystan"
(0 real changes made)

. replace cowcode= 812 if country=="Laos"
(38 real changes made)

. replace cowcode= 812 if country=="Lao"
(0 real changes made)

. replace cowcode= 812 if country=="Lao PDR"
(0 real changes made)

. replace cowcode= 812 if country=="Lao People's Democratic Republic"
(0 real changes made)

. replace cowcode= 367 if country=="Latvia"
(38 real changes made)

. replace cowcode= 660 if country=="Lebanon"
(38 real changes made)

. replace cowcode= 570 if country=="Lesotho"
(38 real changes made)

. replace cowcode= 450 if country=="Liberia"
(38 real changes made)

. replace cowcode= 620 if country=="Libya"
(38 real changes made)

. replace cowcode= 620 if country=="Libyan Arab Jamahiriya"
(0 real changes made)

. replace cowcode= 223 if country=="Liechtenstein"
(0 real changes made)

. replace cowcode= 368 if country=="Lithuania"
(38 real changes made)

. replace cowcode= 212 if country=="Luxembourg"
(38 real changes made)

. replace cowcode= 343 if country=="Macedonia"
(38 real changes made)

. replace cowcode= 343 if country=="Macedonia, FYR"
(0 real changes made)

. replace cowcode= 343 if country=="The former Yugoslav Republic of Macedonia"
(0 real changes made)

. replace cowcode= 343 if country=="Macedonia, The Former Yugoslav Republic of"
(0 real changes made)

. replace cowcode= 343 if country=="Macedonia, the Former Yugoslav Republic of"
(0 real changes made)

. replace cowcode= 580 if country=="Madagascar"
(38 real changes made)

. replace cowcode= 580 if country=="Malagasy R"
(0 real changes made)

. replace cowcode= 553 if country=="Malawi"
(38 real changes made)

. replace cowcode= 820 if country=="Malaysia"
(38 real changes made)

. replace cowcode= 820 if country=="Fed Malaya"
(0 real changes made)

. replace cowcode= 781 if country=="Maldives"
(38 real changes made)

. replace cowcode= 781 if country=="Maldive Islands"
(0 real changes made)

. replace cowcode= 432 if country=="Mali"
(38 real changes made)

. replace cowcode= 338 if country=="Malta"
(38 real changes made)

. replace cowcode= 983 if country=="Marshall Islands"
(0 real changes made)

. replace cowcode= 435 if country=="Mauritania"
(38 real changes made)

. replace cowcode= 590 if country=="Mauritius"
(38 real changes made)

. replace cowcode= 70 if country=="Mexico"
(38 real changes made)

. replace cowcode= 987 if country=="Micronesia"
(0 real changes made)

. replace cowcode= 987 if country=="Federated States of Micronesia"
(0 real changes made)

. replace cowcode= 987 if country=="Micronesia, Federated States of"
(0 real changes made)

. replace cowcode= 359 if country=="Moldova"
(38 real changes made)

. replace cowcode= 221 if country=="Monaco"
(0 real changes made)

. replace cowcode= 712 if country=="Mongolia"
(38 real changes made)

. replace cowcode= 600 if country=="Morocco"
(38 real changes made)

. replace cowcode= 541 if country=="Mozambique"
(38 real changes made)

. replace cowcode= 775 if country=="Burma"
(0 real changes made)

. replace cowcode= 775 if country=="Myanmar"
(38 real changes made)

. replace cowcode= 565 if country=="Namibia"
(38 real changes made)

. replace cowcode= 970 if country=="Nauru"
(0 real changes made)

. replace cowcode= 790 if country=="Nepal"
(38 real changes made)

. replace cowcode= 210 if country=="Netherlands"
(38 real changes made)

. replace cowcode= 920 if country=="New Zealand"
(38 real changes made)

. replace cowcode= 93 if country=="Nicaragua"
(38 real changes made)

. replace cowcode= 436 if country=="Niger"
(38 real changes made)

. replace cowcode= 475 if country=="Nigeria"
(38 real changes made)

. replace cowcode= 385 if country=="Norway"
(38 real changes made)

. replace cowcode= 698 if country=="Oman"
(38 real changes made)

. replace cowcode= 770 if country=="Pakistan"
(38 real changes made)

. replace cowcode= 986 if country=="Palau"
(0 real changes made)

. replace cowcode= 95 if country=="Panama"
(38 real changes made)

. replace cowcode= 910 if country=="Papua New Guinea"
(0 real changes made)

. replace cowcode= 910 if country=="Papua N.G."
(0 real changes made)

. replace cowcode= 150 if country=="Paraguay"
(38 real changes made)

. replace cowcode= 135 if country=="Peru"
(38 real changes made)

. replace cowcode= 840 if country=="Philippines"
(38 real changes made)

. replace cowcode= 290 if country=="Poland"
(38 real changes made)

. replace cowcode= 235 if country=="Portugal"
(38 real changes made)

. replace cowcode= 694 if country=="Qatar"
(38 real changes made)

. replace cowcode= 360 if country=="Romania"
(38 real changes made)

. replace cowcode= 365 if country=="Russia"
(21 real changes made)

. replace cowcode= 365 if country=="Russian Federation"
(0 real changes made)

. replace cowcode= 517 if country=="Rwanda"
(38 real changes made)

. replace cowcode= 990 if country=="Samoa"
(38 real changes made)

. replace cowcode= 331 if country=="San Marino"
(0 real changes made)

. replace cowcode= 403 if country=="Sao Tome and Principe"
(0 real changes made)

. replace cowcode= 403 if country=="Sao Tome & Principe"
(0 real changes made)

. replace cowcode= 670 if country=="Saudi Arabia"
(38 real changes made)

. replace cowcode= 433 if country=="Senegal"
(38 real changes made)

. replace cowcode= 345 if country=="Serbia"  
(0 real changes made)

. replace cowcode= 345 if country=="Serbia & Montenegro"  
(0 real changes made)

. replace cowcode= 345 if country=="Serbia and Montenegro"  
(0 real changes made)

. replace cowcode= 591 if country=="Seychelles"
(0 real changes made)

. replace cowcode= 451 if country=="Sierra Leone"
(38 real changes made)

. replace cowcode= 830 if country=="Singapore"
(38 real changes made)

. replace cowcode= 317 if country=="Slovakia"
(38 real changes made)

. replace cowcode= 317 if country=="Slovak Republic"
(0 real changes made)

. replace cowcode= 349 if country=="Slovenia"
(38 real changes made)

. replace cowcode= 520 if country=="Somalia"
(38 real changes made)

. replace cowcode= 520 if country=="Somaliland"
(0 real changes made)

. replace cowcode= 940 if country=="Solomon Islands"
(0 real changes made)

. replace cowcode= 560 if country=="South Africa"
(0 real changes made)

. replace cowcode= 817 if country=="South Vietnam"
(0 real changes made)

. replace cowcode= 817 if country=="Vietnam South"
(0 real changes made)

. replace cowcode= 680 if country=="South Yemen"
(0 real changes made)

. replace cowcode= 365 if country=="Soviet Union"
(17 real changes made)

. replace cowcode= 230 if country=="Spain"
(38 real changes made)

. replace cowcode= 780 if country=="Sri Lanka"
(38 real changes made)

. replace cowcode= 60 if country=="St Kitts and Nevis"
(0 real changes made)

. replace cowcode= 60 if country=="Saint Kitts & Nevis"
(0 real changes made)

. replace cowcode= 60 if country=="St. Kitts-Nevis"
(0 real changes made)

. replace cowcode= 60 if country=="Saint Kitts and Nevis"
(0 real changes made)

. replace cowcode= 56 if country=="St Lucia"
(0 real changes made)

. replace cowcode= 56 if country=="Saint Lucia"
(0 real changes made)

. replace cowcode= 57 if country=="St Vincent and the Grenadines"
(0 real changes made)

. replace cowcode= 57 if country=="St.Vincent & Grenadines"
(0 real changes made)

. replace cowcode= 57 if country=="Saint Vincent and Grenadines"
(0 real changes made)

. replace cowcode= 57 if country=="St Vincent & the Grenadines"
(0 real changes made)

. replace cowcode= 625 if country=="Sudan"
(38 real changes made)

. replace cowcode= 115 if country=="Suriname"
(38 real changes made)

. replace cowcode= 572 if country=="Swaziland"
(38 real changes made)

. replace cowcode= 380 if country=="Sweden"
(38 real changes made)

. replace cowcode= 225 if country=="Switzerland"
(38 real changes made)

. replace cowcode= 652 if country=="Syria"
(38 real changes made)

. replace cowcode= 652 if country=="Syrian Arab Republic"
(0 real changes made)

. replace cowcode= 713 if country=="Taiwan"
(38 real changes made)

. replace cowcode= 702 if country=="Tajikistan"
(38 real changes made)

. replace cowcode= 510 if country=="Tanzania"
(38 real changes made)

. replace cowcode= 510 if country=="Tanzania, United Republic of"
(0 real changes made)

. replace cowcode= 510 if country=="Tanganyika"
(0 real changes made)

. replace cowcode= 800 if country=="Thailand"
(38 real changes made)

. replace cowcode= 711 if country=="Tibet"
(0 real changes made)

. replace cowcode= 860 if country=="Timor-Leste"
(38 real changes made)

. replace cowcode= 860 if country=="Timor Leste"
(0 real changes made)

. replace cowcode= 461 if country=="Togo"
(38 real changes made)

. replace cowcode= 955 if country=="Tonga"
(0 real changes made)

. replace cowcode= 52 if country=="Trinidad and Tobago"
(0 real changes made)

. replace cowcode= 52 if country=="Trinidad & Tobago"
(0 real changes made)

. replace cowcode= 616 if country=="Tunisia"
(38 real changes made)

. replace cowcode= 640 if country=="Turkey"
(38 real changes made)

. replace cowcode= 701 if country=="Turkmenistan"
(38 real changes made)

. replace cowcode= 947 if country=="Tuvalu"
(0 real changes made)

. replace cowcode= 696 if country=="UAE"
(38 real changes made)

. replace cowcode= 696 if country=="United Arab Emirates"
(0 real changes made)

. replace cowcode= 696 if country=="U. Arab Emirates"
(0 real changes made)

. replace cowcode= 500 if country=="Uganda"
(38 real changes made)

. replace cowcode= 369 if country=="Ukraine"
(38 real changes made)

. replace cowcode= 200 if country=="United Kingdom"
(0 real changes made)

. replace cowcode= 200 if country=="Uk"
(0 real changes made)

. replace cowcode= 200 if country=="United  Kingdom"
(0 real changes made)

. replace cowcode= 2 if country=="Usa"
(0 real changes made)

. replace cowcode= 2 if country=="USA"
(38 real changes made)

. replace cowcode= 2 if country=="United States"
(0 real changes made)

. replace cowcode= 2 if country=="United States of America"
(0 real changes made)

. replace cowcode= 165 if country=="Uruguay"
(38 real changes made)

. replace cowcode= 365 if country=="USSR"
(0 real changes made)

. replace cowcode= 704 if country=="Uzbekistan"
(38 real changes made)

. replace cowcode= 935 if country=="Vanuatu"
(38 real changes made)

. replace cowcode= 101 if country=="Venezuela"
(38 real changes made)

. replace cowcode= 101 if country=="Venezuela, Bolivarian Republic of"
(0 real changes made)

. replace cowcode= 101 if country=="Venezuela, RB"
(0 real changes made)

. replace cowcode= 816 if country=="Vietnam"
(38 real changes made)

. replace cowcode= 816 if country=="Vietnam North"
(0 real changes made)

. replace cowcode= 816 if country=="Viet Nam"
(0 real changes made)

. replace cowcode= 680 if country=="Yemen (PDR)"
(37 real changes made)

. replace cowcode= 680 if country=="Yemen, (PDR)"
(0 real changes made)

. replace cowcode= 680 if country=="Yemen Peop. Rep."
(0 real changes made)

. replace cowcode= 680 if country=="South Yemen"
(0 real changes made)

. replace cowcode= 680 if country=="Yemen South"
(0 real changes made)

. replace cowcode= 678 if country=="Yemen (AR)"
(15 real changes made)

. replace cowcode= 678 if country=="Yemen, (AR)"
(0 real changes made)

. replace cowcode= 678 if country=="Yemen Arab Rep."
(0 real changes made)

. replace cowcode= 678 if country=="Yemen, Republic of"
(0 real changes made)

. replace cowcode= 678 if country=="Yemen, Rep."
(0 real changes made)

. replace cowcode= 678 if country=="Yemen North"
(0 real changes made)

. replace cowcode= 678 if country=="Yemen"
(23 real changes made)

. replace cowcode= 680 if country=="Yemen (PDR)"
(0 real changes made)

. replace cowcode= 680 if country=="Yemen, (PDR)"
(0 real changes made)

. replace cowcode= 680 if country=="Yemen Peop. Rep."
(0 real changes made)

. replace cowcode= 680 if country=="Yemen P Dem Rep"
(0 real changes made)

. replace cowcode= 680 if country=="South Yemen"
(0 real changes made)

. replace cowcode= 678 if country=="Yemen (AR)"
(0 real changes made)

. replace cowcode= 678 if country=="Yemen, (AR)"
(0 real changes made)

. replace cowcode= 678 if country=="Yemen Arab Rep."
(0 real changes made)

. replace cowcode= 678 if country=="Yemen Arab Rep"
(0 real changes made)

. replace cowcode= 678 if country=="Yemen, Republic of"
(0 real changes made)

. replace cowcode= 678 if country=="Yemen, Rep."
(0 real changes made)

. replace cowcode= 678 if country=="Yemen"
(0 real changes made)

. replace cowcode= 678 if country=="Yemen, North"
(0 real changes made)

. 
. 
. replace cowcode= 345 if country=="Yugoslavia"
(37 real changes made)

. replace cowcode= 345 if country=="Yugoslavia, FR"
(0 real changes made)

. replace cowcode= 551 if country=="Zambia"
(38 real changes made)

. replace cowcode= 511 if country=="Zanzibar"
(0 real changes made)

. replace cowcode= 552 if country=="Zimbabwe"
(38 real changes made)

. 
. replace cowcode= 775 if country=="Burma (Myanmar)"
(0 real changes made)

. replace cowcode= 490 if country=="DRCongo"
(0 real changes made)

. replace cowcode= 490 if country=="D. R. Congo"
(0 real changes made)

. replace cowcode= 678 if country=="North Yemen"
(0 real changes made)

. replace cowcode= 484 if country=="Congo-Brazzaville"
(0 real changes made)

. replace cowcode= 482 if country=="Cent. African Rep."
(0 real changes made)

. replace cowcode= 696 if country=="United Arab Em."
(0 real changes made)

. replace cowcode= 860 if country=="East Timor"
(0 real changes made)

.  
. ** DPI **
. replace cowcode=        346     if country=="Bosnia-Herz"
(38 real changes made)

. replace cowcode=        482     if country=="Cent. Af. Rep."
(38 real changes made)

. replace cowcode=        710     if country=="PRC"
(38 real changes made)

. replace cowcode=        402     if country=="C. Verde Is."
(38 real changes made)

. replace cowcode=        316     if country=="Czech Rep."
(38 real changes made)

. replace cowcode=        260     if country=="FRG/Germany"
(38 real changes made)

. replace cowcode=        42      if country=="Dom. Rep."
(38 real changes made)

. replace cowcode=        200     if country=="UK"
(38 real changes made)

. replace cowcode=        411     if country=="Eq. Guinea"
(38 real changes made)

. replace cowcode=        732     if country=="ROK"
(38 real changes made)

. replace cowcode=        56      if country=="St. Lucia"
(38 real changes made)

. replace cowcode=        910     if country=="P. N. Guinea"
(38 real changes made)

. replace cowcode=        731     if country=="PRK"
(38 real changes made)

. replace cowcode=        940     if country=="Solomon Is."
(38 real changes made)

. replace cowcode=        52      if country=="Trinidad-Tobago"
(38 real changes made)

. replace cowcode=        560     if country=="S. Africa"
(38 real changes made)

. replace cowcode=        490     if country=="Congo (DRC)"
(38 real changes made)

. 
. 
end of do-file

. sum cow year

    Variable |        Obs        Mean    Std. Dev.       Min        Max
-------------+---------------------------------------------------------
     cowcode |      6,762    463.3113     246.875          2        990
        year |      6,764      1993.5    10.96642       1975       2012

. list country year if cow==.

      +--------------------+
      |     country   year |
      |--------------------|
   1. | South Sudan   2011 |
   2. | South Sudan   2012 |
      +--------------------+

. drop if cow==.    /* South Sudan dropped */
(2 observations deleted)

. drop if cow==352 /* Cyprus and Turk Cyprus */
(76 observations deleted)

. recode cow (316=315) if year<1993   /* Czechoslakia code prior to 1993 */
(cowcode: 18 changes made)

. recode cow (260=255)   /*   West German code */
(cowcode: 38 changes made)

. tsset cow year
       panel variable:  cowcode (unbalanced)
        time variable:  year, 1975 to 2012
                delta:  1 year

. sort cow year

. gen fail = F.yrsoffc==1 if yrsoffc~=-999
(483 missing values generated)

. tab fail

       fail |      Freq.     Percent        Cum.
------------+-----------------------------------
          0 |      5,304       85.51       85.51
          1 |        899       14.49      100.00
------------+-----------------------------------
      Total |      6,203      100.00

. gen DPI_fail = fail
(483 missing values generated)

. 
. merge cow year using GWFglobal
(note: you are using old merge syntax; see [D] merge for new syntax)

. drop if year>2010 | year<1975    /* 1975-2010 are the years when the 2 data sets overl
> ap */
(3,265 observations deleted)

. drop if yrso==-999
(479 observations deleted)

. tab _merge

     _merge |      Freq.     Percent        Cum.
------------+-----------------------------------
          1 |        852       14.53       14.53
          2 |          6        0.10       14.63
          3 |      5,005       85.37      100.00
------------+-----------------------------------
      Total |      5,863      100.00

. browse if _merge==1   /* small countries not coded in GWF */

.  
. *Autocracy transition*
. gen gwf_AA = gwf_fail==1 & gwf_next~="democracy" & gwf_next~="provisional"  & gwf_non~
> ="democracy" & gwf_non~="provisional"

. *Transition to Democracy*
. gen gwf_AD = gwf_fail==1 & (gwf_next=="democracy" | gwf_next=="provisional")

. *Democratic Failure*
. gen gwf_DA = gwf_fail==1 & (gwf_next~="democracy" & gwf_next~="provisional")  & (gwf_n
> on=="democracy" | gwf_non=="provisional")

. 
. tab gwf_fail gwf_AA

           |        gwf_AA
  gwf_fail |         0          1 |     Total
-----------+----------------------+----------
         0 |     4,823          0 |     4,823 
         1 |       120         68 |       188 
-----------+----------------------+----------
     Total |     4,943         68 |     5,011 


. tab gwf_fail gwf_AD

           |        gwf_AD
  gwf_fail |         0          1 |     Total
-----------+----------------------+----------
         0 |     4,823          0 |     4,823 
         1 |       101         87 |       188 
-----------+----------------------+----------
     Total |     4,924         87 |     5,011 


. tab gwf_fail gwf_DA

           |        gwf_DA
  gwf_fail |         0          1 |     Total
-----------+----------------------+----------
         0 |     4,823          0 |     4,823 
         1 |       155         33 |       188 
-----------+----------------------+----------
     Total |     4,978         33 |     5,011 


. 
. 
. ** Fix (4) inauguration date differences **
.                 *Panama 1990; Chile 1990; Uruguay 1985; South Korea 1988 
. gen gwffail = gwf_fail
(852 missing values generated)

. recode gwffail (0=1) if ((cowc==95 & year==1990) | (cowc==155 & year==1990) | (cowc==1
> 65 & year==1985) | (cowc==732 & year==1988)  )
(gwffail: 4 changes made)

. recode gwf_AD (0=1) if  ((cowc==95 & year==1990) | (cowc==155 & year==1990) | (cowc==1
> 65 & year==1985) | (cowc==732 & year==1988)  )
(gwf_AD: 4 changes made)

. recode gwf_AD (1=0) if  ((cowc==95 & year==1989) | (cowc==155 & year==1989) | (cowc==1
> 65 & year==1984) | (cowc==732 & year==1987)  )
(gwf_AD: 4 changes made)

. 
. **leader failure years when NO regime collapse**
. tab DPI_fail if gwffail==0 & gwf_regimetype~="NA"   & DPI_fail~=.

   DPI_fail |      Freq.     Percent        Cum.
------------+-----------------------------------
          0 |      2,473       93.53       93.53
          1 |        171        6.47      100.00
------------+-----------------------------------
      Total |      2,644      100.00

. tab DPI_fail if gwffail==0 & (gwf_non=="democracy" | gwf_non=="provisional")  & DPI_fa
> il~=.

   DPI_fail |      Freq.     Percent        Cum.
------------+-----------------------------------
          0 |      1,665       79.55       79.55
          1 |        428       20.45      100.00
------------+-----------------------------------
      Total |      2,093      100.00

. 
. **leader failure years when YES regime collapse**
. tab DPI_fail if gwffail==1 & gwf_AA==1 & gwf_regimetype~="NA" & DPI_fail~=.

   DPI_fail |      Freq.     Percent        Cum.
------------+-----------------------------------
          0 |          6       10.34       10.34
          1 |         52       89.66      100.00
------------+-----------------------------------
      Total |         58      100.00

. tab DPI_fail if gwffail==1 & gwf_AD==1 & gwf_regimetype~="NA" & DPI_fail~=.

   DPI_fail |      Freq.     Percent        Cum.
------------+-----------------------------------
          0 |         12       17.91       17.91
          1 |         55       82.09      100.00
------------+-----------------------------------
      Total |         67      100.00

. tab DPI_fail if gwffail==1 & gwf_DA==1 & (gwf_non=="democracy" | gwf_non=="provisional
> ") & DPI_fail~=.

   DPI_fail |      Freq.     Percent        Cum.
------------+-----------------------------------
          0 |         10       31.25       31.25
          1 |         22       68.75      100.00
------------+-----------------------------------
      Total |         32      100.00

. 
. gen graphgwfdpi= .
(5,863 missing values generated)

. replace graphgwfdpi = 428 in 1    /* Democracy survives */
(1 real change made)

. replace graphgwfdpi  = . in 2    
(0 real changes made)

. replace graphgwfdpi  = 22 in 3     /* Democracy-Autocracy */
(1 real change made)

. replace graphgwfdpi = . in 4    
(0 real changes made)

. replace graphgwfdpi  = 55 in 5     /* Autocracy-Democracy */
(1 real change made)

. replace graphgwfdpi  = . in 6  
(0 real changes made)

. replace graphgwfdpi  = 58 in 7    /* Autocracy-Autocracy */
(1 real change made)

. replace graphgwfdpi  = . in 8  
(0 real changes made)

. replace graphgwfdpi  = 171 in 9    /* Autocracy survives */
(1 real change made)

. 
. gen index  = _n in 1/9
(5,854 missing values generated)

. label define allfails  1 "Democracy survives" 2 " "  3 "Democracy-Autocracy"  4 " " 5 
> "Autocracy-Democracy" /*
> */ 6 " " 7 "Autocracy-Autocracy" 8 " "  9 "Autocracy survives"   

. label values index  allfails 

. 
. twoway (bar graphgwfdpi  index, scheme(lean2)  ylabel(0(100)400,glcolor(gs14))   /*
> */ xlabel(1(1)9, valuelabel labsize(small) labcolor(black) labgap(tiny) noticks) xsize
> (10) ysize(5) )/*
> */ (scatter graphgwfdpi  index, ms(none) mla(graphgwfdpi ) mlabpos(12) graphregion(col
> or(white)) /*
> */ xtitle("Type of event",height(8)) ytitle("Number of country-years")  xscale(range (
> 0 10)) yscale(range(0 450)) /*
> */ legend(pos(12) col(1) ring(0) label(1 "DPI Government Failure") label(2 "") bmargin
> (0)) )
(note:  named style 0 not found in class margin, default attributes used)

. *graph export "C:\Users\jwright\Documents\My Dropbox\Research\Autocratic Instability\D
> PIGWF.pdf", as(pdf)  replace
. 
. 
. 
. 
. *****************************************************
. ** Merge and clean data for Ahmed 2012 replication **
. *****************************************************
. use AhmedAPSR, clear

. set more off

. rename COUNTRY_NAME country

. qui gen cowcode=.

. qui do cowcodes

. sum year cow

    Variable |        Obs        Mean    Std. Dev.       Min        Max
-------------+---------------------------------------------------------
        year |     10,167    1981.994    12.98423       1960       2004
     cowcode |      8,369    464.7246    256.5925          2        990

. qui egen tag = tag(country) if cow==.

. list country if tag==1 , clean

                                               country  
    1.                                           Aruba  
  226.                            Netherlands Antilles  
  406.                                  American Samoa  
 1125.                                         Bermuda  
 1575.                                 Channel Islands  
 2070.                                  Cayman Islands  
 2475.                             East Asia & Pacific  
 2520.                           Europe & Central Asia  
 2655.                         European Monetary Union  
 3015.                                  Faeroe Islands  
 3060.                           Micronesia, Fed. Sts.  
 3555.                                       Greenland  
 3645.                                            Guam  
 3735.                                     High income  
 3780.                                Hong Kong, China  
 3870.          Heavily indebted poor countries (HIPC)  
 4095.                                     Isle of Man  
 4815.                             St. Kitts and Nevis  
 4950.                       Latin America & Caribbean  
 5220.   Least developed countries (UN classification)  
 5265.                                      Low income  
 5400.                             Lower middle income  
 5445.                             Low & middle income  
 5670.                                    Macao, China  
 6030.                                   Middle income  
 6255.                      Middle East & North Africa  
 6345.                        Northern Mariana Islands  
 6615.                                         Mayotte  
 6704.                                   New Caledonia  
 6929.                             High income nonOECD  
 7109.                                High income OECD  
 7514.                                     Puerto Rico  
 7694.                                French Polynesia  
 7919.                                      South Asia  
 8368.                              Sub-Saharan Africa  
 9358.                             Upper middle income  
 9538.                  St. Vincent and the Grenadines  
 9628.                           Virgin Islands (U.S.)  
 9763.                              West Bank and Gaza  
 9808.                                           World  

. qui drop if cow==.

. sum cow year

    Variable |        Obs        Mean    Std. Dev.       Min        Max
-------------+---------------------------------------------------------
     cowcode |      8,369    464.7246    256.5925          2        990
        year |      8,369    1981.997     12.9865       1960       2004

. sort cow year

. merge cow year using GWFglobal
(note: you are using old merge syntax; see [D] merge for new syntax)

. qui dprobit turnover aid_remit beta beta_AR finittrm lngdpcap ggdpcap lnpop war ldis h
> dis time_dum* codummy* ydummy*, cluster(govtcode)

. gen sumsamp=e(sample)

. tab _merge if sumsamp  /*Need to get Ethiopia post 1993*/

     _merge |      Freq.     Percent        Cum.
------------+-----------------------------------
          1 |        123        7.50        7.50
          3 |      1,516       92.50      100.00
------------+-----------------------------------
      Total |      1,639      100.00

. 
. tab turnover gwf_fail if sumsamp==1 & turnover==1, m

           |             gwf_fail
  turnover |         0          1          . |     Total
-----------+---------------------------------+----------
         1 |       196         68         27 |       291 
-----------+---------------------------------+----------
     Total |       196         68         27 |       291 


. /*turnover with disagreedpi==. are small island countries*/
. gen turnover1 = turnover
(5,793 missing values generated)

. replace turnover1 = 0 if gwf_fail==1   
(281 real changes made)

. gen turnover2 = turnover
(5,793 missing values generated)

. replace turnover2 = 0 if gwf_fail==0 | (gwf_fail==. & turnover==1) 
(4,232 real changes made)

. 
. 
. /*One-year election/national conference differences*/
. recode turnover1 (1=0) if turnover==1 & ((cow==339 & year==1992) | (cow==434 & year==1
> 991 ) | (cow==484 & year==1992) | (cow==436 & year==1993 ))
(turnover1: 1 changes made)

. recode turnover2 (0=1) if turnover==1 & ((cow==339 & year==1992) | (cow==434 & year==1
> 991 ) | (cow==484 & year==1992) | (cow==436 & year==1993 ))
(turnover2: 1 changes made)

. 
. /*Cote d'Ivoire error: Ahmed codes Cote d'Ivoire 1984 as turnover but this isn't corre
> ct and isn't in the original DPI data */
. replace turnover2 = 0 if cow==437 & year==1984  
(0 real changes made)

. replace turnover1 = 1 if cow==437 & year==1984
(0 real changes made)

. 
. tsset cow year
       panel variable:  cowcode (unbalanced)
        time variable:  year, 1946 to 2010, but with a gap
                delta:  1 unit

. qui dprobit turnover aid_remit beta beta_AR finittrm lngdpcap ggdpcap lnpop war ldis h
> dis time_dum* codummy* ydummy*, cluster(govtcode)

. gen lpolity = l.POLITY2
(4,711 missing values generated)

. gen beta1 = (((POLITY2+11)*-1) +22)/21   /*DEC 31 of obs year coding of polity*/
(4,711 missing values generated)

. gen beta2 = (((lpolity+11)*-1) +22)/21   /*JAN 1 of obs year coding of polity*/
(4,711 missing values generated)

. gen beta3 = l.beta                       /*JAN 1 of obs year coding of polity, for tra
> nsformed index */
(4,711 missing values generated)

. sum beta POLITY2

    Variable |        Obs        Mean    Std. Dev.       Min        Max
-------------+---------------------------------------------------------
        beta |      5,829    .1941471    .2037856    .047619          1
     POLITY2 |      5,829    .0186996    7.537449        -10         10

. label var beta "Autocracy score"

. label var POLITY2 "Polity index"

. twoway scatter beta POLITY2

. *graph export "C:\Users\jwright\Documents\My Dropbox\Research\Autocratic Instability\A
> utocracyScore.pdf", as(pdf)                            replace
. 
. gen beta1_AR = beta1*aid_remit
(8,058 missing values generated)

. gen beta2_AR = beta2*aid_remit
(8,059 missing values generated)

. gen beta3_AR = beta3*aid_remit
(8,059 missing values generated)

. 
. corr beta beta1 beta2 beta3
(obs=5,666)

             |     beta    beta1    beta2    beta3
-------------+------------------------------------
        beta |   1.0000
       beta1 |   0.7420   1.0000
       beta2 |   0.7197   0.9714   1.0000
       beta3 |   0.9678   0.7249   0.7415   1.0000


. corr beta_AR beta1_AR beta2_AR beta3_AR
(obs=2,476)

             |  beta_AR beta1_AR beta2_AR beta3_AR
-------------+------------------------------------
     beta_AR |   1.0000
    beta1_AR |   0.8182   1.0000
    beta2_AR |   0.7977   0.9784   1.0000
    beta3_AR |   0.9787   0.8114   0.8194   1.0000


. 
. gen beta_muslimoil = beta*muslimoil
(4,711 missing values generated)

. gen beta1_muslimoil = beta1*muslimoil
(4,711 missing values generated)

. gen beta2_muslimoil = beta2*muslimoil
(4,712 missing values generated)

. gen beta3_muslimoil = beta3*muslimoil
(4,712 missing values generated)

. 
. label var aid_remit "Aid & Remittances"

. label var beta3 "Autocracy"

. label var turnover "Failure"

. label var turnover1 "Failure"

. label var turnover2 "Failure"

. drop _merge

. saveold temp, replace
(saving in Stata 13 format)
(FYI, saveold has options version(12) and version(11) that write files in older Stata
      formats)
file temp.dta saved

. saveold temp_Ahmed, replace
(saving in Stata 13 format)
(FYI, saveold has options version(12) and version(11) that write files in older Stata
      formats)
file temp_Ahmed.dta saved

. 
. 
. **********************************
. ** Ahmed 2012, Table 3 column 2 **
. **********************************
. 
. sort country year

. browse country year if sumsamp==1 & turnover1==1 & turnover==1

. browse country year if sumsamp==1 & turnover2==1 & turnover==1

. 
. *Replication
.    qui probit turnover aid_remit beta beta_AR finittrm lngdpcap ggdpcap lnpop war ldis
>  hdis time_dum* codummy* ydummy* if sumsamp==1, cluster(govtcode)

.         *sum beta if e(sample), detail
.         tab turnover if e(sample)

    Failure |      Freq.     Percent        Cum.
------------+-----------------------------------
          0 |      1,348       82.25       82.25
          1 |        291       17.75      100.00
------------+-----------------------------------
      Total |      1,639      100.00

.         lincom aid_remit + beta_AR*.048   /*5 pctile*/

 ( 1)  [turnover]aid_remit + .048*[turnover]beta_AR = 0

------------------------------------------------------------------------------
    turnover |      Coef.   Std. Err.      z    P>|z|     [95% Conf. Interval]
-------------+----------------------------------------------------------------
         (1) |   .0088917   .0125021     0.71   0.477    -.0156119    .0333954
------------------------------------------------------------------------------

.         lincom aid_remit + beta_AR*.5   /*95 pctile*/

 ( 1)  [turnover]aid_remit + .5*[turnover]beta_AR = 0

------------------------------------------------------------------------------
    turnover |      Coef.   Std. Err.      z    P>|z|     [95% Conf. Interval]
-------------+----------------------------------------------------------------
         (1) |  -.0659512   .0364271    -1.81   0.070    -.1373469    .0054446
------------------------------------------------------------------------------

.         est store a1

. 
. *DPI fail and GWF fail
.   qui probit turnover2 aid_remit beta beta_AR finittrm lngdpcap ggdpcap lnpop war ldis
>  hdis time_dum* codummy* ydummy* if sumsamp==1, cluster(govtcode)

.         *sum beta if e(sample), detail
.         tab turnover2 if e(sample)

    Failure |      Freq.     Percent        Cum.
------------+-----------------------------------
          0 |        822       92.26       92.26
          1 |         69        7.74      100.00
------------+-----------------------------------
      Total |        891      100.00

.         lincom aid_remit + beta_AR*.053   /*5 pctile*/

 ( 1)  [turnover2]aid_remit + .053*[turnover2]beta_AR = 0

------------------------------------------------------------------------------
   turnover2 |      Coef.   Std. Err.      z    P>|z|     [95% Conf. Interval]
-------------+----------------------------------------------------------------
         (1) |   .0363852   .0167292     2.17   0.030     .0035966    .0691738
------------------------------------------------------------------------------

.         lincom aid_remit + beta_AR*.5   /*95 pctile*/

 ( 1)  [turnover2]aid_remit + .5*[turnover2]beta_AR = 0

------------------------------------------------------------------------------
   turnover2 |      Coef.   Std. Err.      z    P>|z|     [95% Conf. Interval]
-------------+----------------------------------------------------------------
         (1) |    .056423   .0388644     1.45   0.147    -.0197497    .1325958
------------------------------------------------------------------------------

.         est store a2

. 
. *DPI fail but NO GWF fail
.   qui probit turnover1 aid_remit beta beta_AR finittrm lngdpcap ggdpcap lnpop war ldis
>  hdis time_dum* codummy* ydummy* if sumsamp==1, cluster(govtcode)

.         *sum beta if e(sample), detail
.         tab turnover1 if e(sample)

    Failure |      Freq.     Percent        Cum.
------------+-----------------------------------
          0 |      1,178       84.14       84.14
          1 |        222       15.86      100.00
------------+-----------------------------------
      Total |      1,400      100.00

.         lincom aid_remit + beta_AR*.048   /*5 pctile*/

 ( 1)  [turnover1]aid_remit + .048*[turnover1]beta_AR = 0

------------------------------------------------------------------------------
   turnover1 |      Coef.   Std. Err.      z    P>|z|     [95% Conf. Interval]
-------------+----------------------------------------------------------------
         (1) |  -.0166579   .0143212    -1.16   0.245     -.044727    .0114113
------------------------------------------------------------------------------

.         lincom aid_remit + beta_AR*.5   /*95 pctile*/

 ( 1)  [turnover1]aid_remit + .5*[turnover1]beta_AR = 0

------------------------------------------------------------------------------
   turnover1 |      Coef.   Std. Err.      z    P>|z|     [95% Conf. Interval]
-------------+----------------------------------------------------------------
         (1) |    -.11744   .0479124    -2.45   0.014    -.2113466   -.0235333
------------------------------------------------------------------------------

.         est store a3

. 
. *Replication w. correctly lagged beta
.   qui probit turnover aid_remit beta3 beta3_AR finittrm lngdpcap ggdpcap lnpop war ldi
> s hdis time_dum* codummy* ydummy* if sumsamp==1, cluster(govtcode)

.         *sum beta3 if e(sample), detail
.         tab turnover if e(sample)

    Failure |      Freq.     Percent        Cum.
------------+-----------------------------------
          0 |      1,348       82.30       82.30
          1 |        290       17.70      100.00
------------+-----------------------------------
      Total |      1,638      100.00

.         lincom aid_remit + beta3_AR*.048   /*5 pctile*/

 ( 1)  [turnover]aid_remit + .048*[turnover]beta3_AR = 0

------------------------------------------------------------------------------
    turnover |      Coef.   Std. Err.      z    P>|z|     [95% Conf. Interval]
-------------+----------------------------------------------------------------
         (1) |   .0026526   .0139091     0.19   0.849    -.0246087    .0299138
------------------------------------------------------------------------------

.         lincom aid_remit + beta3_AR*.5   /*95 pctile*/

 ( 1)  [turnover]aid_remit + .5*[turnover]beta3_AR = 0

------------------------------------------------------------------------------
    turnover |      Coef.   Std. Err.      z    P>|z|     [95% Conf. Interval]
-------------+----------------------------------------------------------------
         (1) |  -.0172191   .0270776    -0.64   0.525    -.0702902    .0358521
------------------------------------------------------------------------------

.         est store a4

. 
. *DPI fail and GWF fail w. correctly lagged beta
.   qui probit turnover2 aid_remit beta3 beta3_AR finittrm lngdpcap ggdpcap lnpop war ld
> is hdis time_dum* codummy* ydummy* if sumsamp==1, cluster(govtcode)

.         *sum beta3 if e(sample), detail
.         tab turnover2 if e(sample)

    Failure |      Freq.     Percent        Cum.
------------+-----------------------------------
          0 |        790       92.07       92.07
          1 |         68        7.93      100.00
------------+-----------------------------------
      Total |        858      100.00

.         lincom aid_remit + beta3_AR*.053   /*5 pctile*/

 ( 1)  [turnover2]aid_remit + .053*[turnover2]beta3_AR = 0

------------------------------------------------------------------------------
   turnover2 |      Coef.   Std. Err.      z    P>|z|     [95% Conf. Interval]
-------------+----------------------------------------------------------------
         (1) |   .0369386   .0197585     1.87   0.062    -.0017873    .0756645
------------------------------------------------------------------------------

.         lincom aid_remit + beta3_AR*.5   /*95 pctile*/

 ( 1)  [turnover2]aid_remit + .5*[turnover2]beta3_AR = 0

------------------------------------------------------------------------------
   turnover2 |      Coef.   Std. Err.      z    P>|z|     [95% Conf. Interval]
-------------+----------------------------------------------------------------
         (1) |   .0796236   .0374512     2.13   0.033     .0062205    .1530266
------------------------------------------------------------------------------

.         est store a5

.  
. *DPI fail and NO GWF fail w. correctly lagged beta
.   qui probit turnover1 aid_remit beta3 beta3_AR finittrm lngdpcap ggdpcap lnpop war ld
> is hdis time_dum* codummy* ydummy* if sumsamp==1, cluster(govtcode)

.         *sum beta3 if e(sample), detail
.         tab turnover1 if e(sample)

    Failure |      Freq.     Percent        Cum.
------------+-----------------------------------
          0 |      1,177       84.13       84.13
          1 |        222       15.87      100.00
------------+-----------------------------------
      Total |      1,399      100.00

.         lincom aid_remit + beta3_AR*.048   /*5 pctile*/

 ( 1)  [turnover1]aid_remit + .048*[turnover1]beta3_AR = 0

------------------------------------------------------------------------------
   turnover1 |      Coef.   Std. Err.      z    P>|z|     [95% Conf. Interval]
-------------+----------------------------------------------------------------
         (1) |  -.0213969   .0161161    -1.33   0.184    -.0529839    .0101901
------------------------------------------------------------------------------

.         lincom aid_remit + beta3_AR*.5   /*95 pctile*/

 ( 1)  [turnover1]aid_remit + .5*[turnover1]beta3_AR = 0

------------------------------------------------------------------------------
   turnover1 |      Coef.   Std. Err.      z    P>|z|     [95% Conf. Interval]
-------------+----------------------------------------------------------------
         (1) |  -.0838898   .0419349    -2.00   0.045    -.1660806   -.0016989
------------------------------------------------------------------------------

.         est store a6

.  
. set matsize 2000

. *set emptycells drop
. estout a1 a2 a3 a4 a5 a6 using Table3.tex, cells(b(star  fmt(%9.3f)) se(par fmt(%9.2f)
> )) stats(ll r2 N) style(tex) replace label starlevels(* 0.10 ** 0.05)
(output written to Table3.tex)

. set matsize 500

. 
. ********************************
. ** Full sample specifications **
. ********************************
. use temp, clear

. qui probit turnover aid_remit beta3 beta3_AR finittrm lngdpcap ggdpcap lnpop war ldis 
> hdis time time2 time3 year  africa nam asia sam if sumsamp==1, cluster(cow)

. sum beta3 if e(sample), detail

                          Autocracy
-------------------------------------------------------------
      Percentiles      Smallest
 1%      .047619        .047619
 5%      .047619        .047619
10%          .05        .047619       Obs               1,638
25%     .0555556        .047619       Sum of Wgt.       1,638

50%     .0909091                      Mean           .1757896
                        Largest       Std. Dev.      .1849825
75%          .25              1
90%     .3333333              1       Variance       .0342185
95%           .5              1       Skewness       2.606952
99%            1              1       Kurtosis       11.28912

. lincom aid_remit + beta3_AR*.048  /*5 pctile*/

 ( 1)  [turnover]aid_remit + .048*[turnover]beta3_AR = 0

------------------------------------------------------------------------------
    turnover |      Coef.   Std. Err.      z    P>|z|     [95% Conf. Interval]
-------------+----------------------------------------------------------------
         (1) |  -.0071692   .0075675    -0.95   0.343    -.0220013     .007663
------------------------------------------------------------------------------

. lincom aid_remit + beta3_AR*.5   /*95 pctile*/

 ( 1)  [turnover]aid_remit + .5*[turnover]beta3_AR = 0

------------------------------------------------------------------------------
    turnover |      Coef.   Std. Err.      z    P>|z|     [95% Conf. Interval]
-------------+----------------------------------------------------------------
         (1) |  -.0040536   .0125963    -0.32   0.748    -.0287418    .0206347
------------------------------------------------------------------------------

.  
. qui probit turnover2 aid_remit beta3 beta3_AR finittrm lngdpcap ggdpcap lnpop war ldis
>  hdis time time2 time3 year  africa nam asia sam if sumsamp==1, cluster(cow)

. sum beta3 if e(sample), detail

                          Autocracy
-------------------------------------------------------------
      Percentiles      Smallest
 1%      .047619        .047619
 5%      .047619        .047619
10%          .05        .047619       Obs               1,638
25%     .0555556        .047619       Sum of Wgt.       1,638

50%     .0909091                      Mean           .1757896
                        Largest       Std. Dev.      .1849825
75%          .25              1
90%     .3333333              1       Variance       .0342185
95%           .5              1       Skewness       2.606952
99%            1              1       Kurtosis       11.28912

. lincom aid_remit + beta3_AR*.053   /*5 pctile*/

 ( 1)  [turnover2]aid_remit + .053*[turnover2]beta3_AR = 0

------------------------------------------------------------------------------
   turnover2 |      Coef.   Std. Err.      z    P>|z|     [95% Conf. Interval]
-------------+----------------------------------------------------------------
         (1) |   .0056669   .0106827     0.53   0.596    -.0152707    .0266046
------------------------------------------------------------------------------

. lincom aid_remit + beta3_AR*.5   /*95 pctile*/

 ( 1)  [turnover2]aid_remit + .5*[turnover2]beta3_AR = 0

------------------------------------------------------------------------------
   turnover2 |      Coef.   Std. Err.      z    P>|z|     [95% Conf. Interval]
-------------+----------------------------------------------------------------
         (1) |   .0279943   .0198435     1.41   0.158    -.0108983    .0668869
------------------------------------------------------------------------------

.  
. qui probit turnover1 aid_remit beta3 beta3_AR finittrm lngdpcap ggdpcap lnpop war ldis
>  hdis time time2 time3 year  africa nam asia sam if sumsamp==1, cluster(cow)

. sum beta3 if e(sample), detail

                          Autocracy
-------------------------------------------------------------
      Percentiles      Smallest
 1%      .047619        .047619
 5%      .047619        .047619
10%          .05        .047619       Obs               1,638
25%     .0555556        .047619       Sum of Wgt.       1,638

50%     .0909091                      Mean           .1757896
                        Largest       Std. Dev.      .1849825
75%          .25              1
90%     .3333333              1       Variance       .0342185
95%           .5              1       Skewness       2.606952
99%            1              1       Kurtosis       11.28912

. lincom aid_remit + beta3_AR*.048   /*5 pctile*/

 ( 1)  [turnover1]aid_remit + .048*[turnover1]beta3_AR = 0

------------------------------------------------------------------------------
   turnover1 |      Coef.   Std. Err.      z    P>|z|     [95% Conf. Interval]
-------------+----------------------------------------------------------------
         (1) |  -.0184568   .0083488    -2.21   0.027    -.0348202   -.0020934
------------------------------------------------------------------------------

. lincom aid_remit + beta3_AR*.5   /*95 pctile*/

 ( 1)  [turnover1]aid_remit + .5*[turnover1]beta3_AR = 0

------------------------------------------------------------------------------
   turnover1 |      Coef.   Std. Err.      z    P>|z|     [95% Conf. Interval]
-------------+----------------------------------------------------------------
         (1) |  -.0276649   .0157657    -1.75   0.079     -.058565    .0032353
------------------------------------------------------------------------------

.  
.  *******************
.  *** Simulations ***   ydummy53, codummy28 for turnover2, codummy54 for turnover/turno
> ver1 time_dum6
.  *******************
.  /*    Simulations run separately in Stata 9  
>  
>  * (1) *
>  use temp, clear
>  set more off
>  probit turnover aid_remit beta beta_AR finittrm lngdpcap ggdpcap lnpop war ldis hdis 
> time_dum* codummy* ydummy* if sumsamp==1, cluster(govtcode)
>  matrix m1 = e(b)
>  scalar s1 = colsof(m1)
>  scalar list s1 /*162*/
>  set seed 9879789
>  drawnorm b1-b162, n(10000) means(e(b)) cov(e(V))  clear 
>  gen PROB1dem=.
>  gen PROB1demlow=.
>  gen PROB1demhigh=.
>  gen PROB1aut=.
>  gen PROB1autlow=.
>  gen PROB1authigh=.
> 
>  gen a =.
>  gen ar_axis = (_n-1)/5 + 0.5 if _n<=132
>  /*We want nt to run from 0.5 to 26.5, ie from 5pctile to 95pctile*/ 
>  local a=0.5
>  while `a' <= 26.5 {
>         gen x_betaDem  = b1*`a'+b2*.05+b3*.05*`a'+b4*1+b5*6.86+b6*1.34+b7*16.06+b8*0+b
> 9*0+b10*0+b15*1+b61*1+b156*1+b162*1
>         gen x_betaAut  = b1*`a'+b2*.5+b3*.5*`a'  +b4*1+b5*6.86+b6*1.34+b7*16.06+b8*0+b
> 9*0+b10*0+b15*1+b61*1+b156*1+b162*1
>         gen probD = normal(x_betaDem)
>         gen probA = normal(x_betaAut) 
>         egen probDhat = mean(probD)
>       _pctile probD, p(2.5,97.5) 
>       scalar probDlow= r(r1) 
>       scalar probDhigh= r(r2) 
>         egen probAhat = mean(probA)
>       _pctile probA, p(2.5,97.5) 
>       scalar probAlow= r(r1) 
>       scalar probAhigh= r(r2) 
>         quietly replace a = `a' 
>         quietly replace PROB1dem =  probDhat  if ar_axis==a
>         quietly replace PROB1demlow =  probDlow  if ar_axis==a
>         quietly replace PROB1demhigh =  probDhigh  if ar_axis==a
>         quietly replace PROB1aut =  probAhat  if ar_axis==a
>         quietly replace PROB1autlow =  probAlow  if ar_axis==a
>         quietly replace PROB1authigh =  probAhigh  if ar_axis==a
>         drop x_beta* prob*  
>         local a = `a' + .2
>  }
>  label var ar_axis "Aid + Remit"
>  label var PROB1dem "All failures"
>  label var PROB1aut "All failures"
>  sort ar_axis
>  twoway (line PROB1dem ar_axis)  (line PROB1aut ar_axis) 
>  saveold Arep1, replace
>  
>   * (2) *
>   use temp, clear
>   set more off
>   probit turnover2 aid_remit beta beta_AR finittrm lngdpcap ggdpcap lnpop war ldis hdi
> s   time_dum*  codummy* ydummy* if sumsamp==1, cluster(govtcode)
>    matrix m1 = e(b)
>   scalar s1 = colsof(m1)
>   scalar list s1 /*110*/
>   drawnorm b1-b110, n(10000) means(e(b)) cov(e(V))  clear 
>  gen PROB2dem=.
>  gen PROB2demlow=.
>  gen PROB2demhigh=.
>  gen PROB2aut=.
>  gen PROB2autlow=.
>  gen PROB2authigh=.
>   gen a =.
>   gen ar_axis = (_n-1)/5 + 0.5 if _n<=132
>   /*We want nt to run from 0.5 to 26.5, ie from 5pctile to 95pctile*/ 
>   local a=0.5
>   while `a' <= 26.5 {
>         gen x_betaDem  = b1*`a'+b2*.05+b3*.05*`a'+b4*1+b5*6.86+b6*1.34+b7*16.06+b8*0+b
> 9*0+b10*0+b15*1+b42*1+b104*1+b110*1
>         gen x_betaAut  = b1*`a'+b2*.5+b3*.5*`a'  +b4*1+b5*6.86+b6*1.34+b7*16.06+b8*0+b
> 9*0+b10*0+b15*1+b42*1+b104*1+b110*1
>         gen probD = normal(x_betaDem)
>         gen probA = normal(x_betaAut) 
>         egen probDhat = mean(probD)
>       _pctile probD, p(2.5,97.5) 
>       scalar probDlow= r(r1) 
>       scalar probDhigh= r(r2) 
>         egen probAhat = mean(probA)
>       _pctile probA, p(2.5,97.5) 
>       scalar probAlow= r(r1) 
>       scalar probAhigh= r(r2) 
>         quietly replace a = `a' 
>         quietly replace PROB2dem =  probDhat  if ar_axis==a
>         quietly replace PROB2demlow =  probDlow  if ar_axis==a
>         quietly replace PROB2demhigh =  probDhigh  if ar_axis==a
>         quietly replace PROB2aut =  probAhat  if ar_axis==a
>         quietly replace PROB2autlow =  probAlow  if ar_axis==a
>         quietly replace PROB2authigh =  probAhigh  if ar_axis==a
>         drop x_beta* prob*  
>         local a = `a' + .2
>   }
>   label var ar_axis "Aid + Remit"
>   label var PROB2dem "Regime collapse"
>   label var PROB2aut "Regime collapse"
>   sort ar_axis
>   twoway (line PROB2dem ar_axis)  (line PROB2aut ar_axis) 
>  saveold Arep2, replace
>  
>   * (3) *
>   use temp, clear
>   set more off
>   probit turnover1 aid_remit beta beta_AR finittrm lngdpcap ggdpcap lnpop war ldis hdi
> s time_dum*  codummy* ydummy* if sumsamp==1, cluster(govtcode)
>     matrix m1 = e(b)
>   scalar s1 = colsof(m1)
>   scalar list s1 /*145*/
>   drawnorm b1-b145, n(10000) means(e(b)) cov(e(V))  clear 
>   gen PROB3dem=.
>   gen PROB3demlow=.
>   gen PROB3demhigh=.
>   gen PROB3aut=.
>   gen PROB3autlow=.
>   gen PROB3authigh=.
>   gen a =.
>   gen ar_axis = (_n-1)/5 + 0.5 if _n<=132
>   /*We want nt to run from 0.5 to 26.5, ie from 5pctile to 95pctile*/ 
>   local a=0.5
>   while `a' <= 26.5 {
>         gen x_betaDem  = b1*`a'+b2*.05+b3*.05*`a'+b4*1+b5*6.86+b6*1.34+b7*16.06+b8*0+b
> 9*0+b10*0+b15*1+b54*1+b140*1+b145*1
>         gen x_betaAut  = b1*`a'+b2*.5+b3*.5*`a'  +b4*1+b5*6.86+b6*1.34+b7*16.06+b8*0+b
> 9*0+b10*0+b15*1+b54*1+b140*1+b145*1
>         gen probD = normal(x_betaDem)
>         gen probA = normal(x_betaAut) 
>         egen probDhat = mean(probD)
>       _pctile probD, p(2.5,97.5) 
>       scalar probDlow= r(r1) 
>       scalar probDhigh= r(r2) 
>         egen probAhat = mean(probA)
>       _pctile probA, p(2.5,97.5) 
>       scalar probAlow= r(r1) 
>       scalar probAhigh= r(r2) 
>         quietly replace a = `a' 
>         quietly replace PROB3dem =  probDhat  if ar_axis==a
>         quietly replace PROB3demlow =  probDlow  if ar_axis==a
>         quietly replace PROB3demhigh =  probDhigh  if ar_axis==a
>         quietly replace PROB3aut =  probAhat  if ar_axis==a
>         quietly replace PROB3autlow =  probAlow  if ar_axis==a
>         quietly replace PROB3authigh =  probAhigh  if ar_axis==a
>         drop x_beta* prob*  
>         local a = `a' + .2
>   }
>   label var ar_axis "Aid + Remit"
>   label var PROB3dem "No regime collapse"
>   label var PROB3aut "No regime collapse"
>   sort ar_axis
>   twoway (line PROB3dem ar_axis)  (line PROB3aut ar_axis) 
>   saveold Arep3, replace
>  
>  
>   * (4) *
>  use temp, clear
>  set more off
>  probit turnover aid_remit beta3 beta3_AR finittrm lngdpcap ggdpcap lnpop war ldis hdi
> s time_dum*  codummy* ydummy*  if sumsamp==1, cluster(govtcode)
>  drawnorm b1-b162, n(10000) means(e(b)) cov(e(V))  clear 
>  gen PROB4dem=.
>  gen PROB4demlow=.
>  gen PROB4demhigh=.
>  gen PROB4aut=.
>  gen PROB4autlow=.
>  gen PROB4authigh=.
>  gen a =.
>  gen ar_axis = (_n-1)/5 + 0.5 if _n<=132
>  /*We want nt to run from 0.5 to 26.5, ie from 5pctile to 95pctile*/ 
>  local a=0.5
>  while `a' <= 26.5 {
>         gen x_betaDem  = b1*`a'+b2*.05+b3*.05*`a'+b4*1+b5*6.86+b6*1.34+b7*16.06+b8*0+b
> 9*0+b10*0+b15*1+b61*1+b156*1+b162*1
>         gen x_betaAut  = b1*`a'+b2*.5+b3*.5*`a'  +b4*1+b5*6.86+b6*1.34+b7*16.06+b8*0+b
> 9*0+b10*0+b15*1+b61*1+b156*1+b162*1
>         gen probD = normal(x_betaDem)
>         gen probA = normal(x_betaAut) 
>         egen probDhat = mean(probD)
>       _pctile probD, p(2.5,97.5) 
>       scalar probDlow= r(r1) 
>       scalar probDhigh= r(r2) 
>         egen probAhat = mean(probA)
>       _pctile probA, p(2.5,97.5) 
>       scalar probAlow= r(r1) 
>       scalar probAhigh= r(r2) 
>         quietly replace a = `a' 
>         quietly replace PROB4dem =  probDhat  if ar_axis==a
>         quietly replace PROB4demlow =  probDlow  if ar_axis==a
>         quietly replace PROB4demhigh =  probDhigh  if ar_axis==a
>         quietly replace PROB4aut =  probAhat  if ar_axis==a
>         quietly replace PROB4autlow =  probAlow  if ar_axis==a
>         quietly replace PROB4authigh =  probAhigh  if ar_axis==a
>         drop x_beta* prob*  
>         local a = `a' + .2
>  }
>  label var ar_axis "Aid + Remit"
>  label var PROB4dem "All failures"
>  label var PROB4aut "All failures"
>  sort ar_axis
>  twoway (line PROB4dem ar_axis)  (line PROB4aut ar_axis) 
>  saveold Arep4, replace
>  
>  * (5) *
>  use temp, clear
>  set more off
>  probit turnover2 aid_remit beta3 beta3_AR finittrm lngdpcap ggdpcap lnpop war ldis hd
> is time_dum*  codummy* ydummy* if sumsamp==1, cluster(govtcode)
>    matrix m1 = e(b)
>  scalar s1 = colsof(m1)
>  scalar list s1 /*109*/
>  drawnorm b1-b109, n(10000) means(e(b)) cov(e(V))  clear 
>  gen PROB5dem=.
>  gen PROB5demlow=.
>  gen PROB5demhigh=.
>  gen PROB5aut=.
>  gen PROB5autlow=.
>  gen PROB5authigh=.
>  gen a =.
>  gen ar_axis = (_n-1)/5 + 0.5 if _n<=132
>  /*We want nt to run from 0.5 to 26.5, ie from 5pctile to 95pctile*/ 
>  local a=0.5
>  while `a' <= 26.5 {
>         gen x_betaDem  = b1*`a'+b2*.05+b3*.05*`a'+b4*1+b5*6.86+b6*1.34+b7*16.06+b8*0+b
> 9*0+b10*0+b15*1+b41*1+b105*1+b109*1
>         gen x_betaAut  = b1*`a'+b2*.5+b3*.5*`a'  +b4*1+b5*6.86+b6*1.34+b7*16.06+b8*0+b
> 9*0+b10*0+b15*1+b41*1+b105*1+b109*1
>         gen probD = normal(x_betaDem)
>         gen probA = normal(x_betaAut) 
>         egen probDhat = mean(probD)
>       _pctile probD, p(2.5,97.5) 
>       scalar probDlow= r(r1) 
>       scalar probDhigh= r(r2) 
>         egen probAhat = mean(probA)
>       _pctile probA, p(2.5,97.5) 
>       scalar probAlow= r(r1) 
>       scalar probAhigh= r(r2) 
>         quietly replace a = `a' 
>         quietly replace PROB5dem =  probDhat  if ar_axis==a
>         quietly replace PROB5demlow =  probDlow  if ar_axis==a
>         quietly replace PROB5demhigh =  probDhigh  if ar_axis==a
>         quietly replace PROB5aut =  probAhat  if ar_axis==a
>         quietly replace PROB5autlow =  probAlow  if ar_axis==a
>         quietly replace PROB5authigh =  probAhigh  if ar_axis==a
>         drop x_beta* prob*  
>         local a = `a' + .2
>  }
>  label var ar_axis "Aid + Remit"
>  label var PROB5dem "Regime collapse"
>  label var PROB5aut "Regime collapse"
>  sort ar_axis
>  twoway (line PROB5dem ar_axis)  (line PROB5aut ar_axis) 
>  saveold Arep5, replace
>  
>   * (6) *
>  use temp, clear
>  set more off
>  probit turnover1 aid_remit beta3 beta3_AR finittrm lngdpcap ggdpcap lnpop war ldis hd
> is time_dum*  codummy* ydummy*  if sumsamp==1, cluster(govtcode)
>  drawnorm b1-b145, n(10000) means(e(b)) cov(e(V))  clear 
>  gen PROB6dem=.
>  gen PROB6demlow=.
>  gen PROB6demhigh=.
>  gen PROB6aut=.
>  gen PROB6autlow=.
>  gen PROB6authigh=.
>  gen a =.
>  gen ar_axis = (_n-1)/5 + 0.5 if _n<=132
>  /*We want nt to run from 0.5 to 26.5, ie from 5pctile to 95pctile*/ 
>  local a=0.5
>  while `a' <= 26.5 {
>         gen x_betaDem  = b1*`a'+b2*.05+b3*.05*`a'+b4*1+b5*6.86+b6*1.34+b7*16.06+b8*0+b
> 9*0+b10*0+b15*1+b54*1+b140*1+b145*1
>         gen x_betaAut  = b1*`a'+b2*.5+b3*.5*`a'  +b4*1+b5*6.86+b6*1.34+b7*16.06+b8*0+b
> 9*0+b10*0+b15*1+b54*1+b140*1+b145*1
>         gen probD = normal(x_betaDem)
>         gen probA = normal(x_betaAut) 
>         egen probDhat = mean(probD)
>       _pctile probD, p(2.5,97.5) 
>       scalar probDlow= r(r1) 
>       scalar probDhigh= r(r2) 
>         egen probAhat = mean(probA)
>       _pctile probA, p(2.5,97.5) 
>       scalar probAlow= r(r1) 
>       scalar probAhigh= r(r2) 
>         quietly replace a = `a' 
>         quietly replace PROB6dem =  probDhat  if ar_axis==a
>         quietly replace PROB6demlow =  probDlow  if ar_axis==a
>         quietly replace PROB6demhigh =  probDhigh  if ar_axis==a
>         quietly replace PROB6aut =  probAhat  if ar_axis==a
>         quietly replace PROB6autlow =  probAlow  if ar_axis==a
>         quietly replace PROB6authigh =  probAhigh  if ar_axis==a
>         drop x_beta* prob*  
>         local a = `a' + .2
>  }
>  label var ar_axis "Aid + Remit"
>  label var PROB6dem "No regime collapse"
>  label var PROB6aut "No regime collapse"
>  sort ar_axis
>  twoway (line PROB6dem ar_axis)  (line PROB6aut ar_axis) 
>  saveold Arep6, replace
>  */
.  
.  use Arep1, clear

.  sort ar_axis

.  merge ar_axis using Arep2
(note: you are using old merge syntax; see [D] merge for new syntax)
variable ar_axis does not uniquely identify observations in the master data
variable ar_axis does not uniquely identify observations in Arep2.dta

.  sort ar_axis

.  drop _merge

.  merge ar_axis using Arep3
(note: you are using old merge syntax; see [D] merge for new syntax)
variable ar_axis does not uniquely identify observations in the master data
variable ar_axis does not uniquely identify observations in Arep3.dta

.  sort ar_axis

.  drop _merge

.  merge ar_axis using Arep4
(note: you are using old merge syntax; see [D] merge for new syntax)
variable ar_axis does not uniquely identify observations in the master data
variable ar_axis does not uniquely identify observations in Arep4.dta

.  sort ar_axis

.  drop _merge

.  merge ar_axis using Arep5
(note: you are using old merge syntax; see [D] merge for new syntax)
variable ar_axis does not uniquely identify observations in the master data
variable ar_axis does not uniquely identify observations in Arep5.dta

.  sort ar_axis

.  drop _merge

.  merge ar_axis using Arep6
(note: you are using old merge syntax; see [D] merge for new syntax)
variable ar_axis does not uniquely identify observations in the master data
variable ar_axis does not uniquely identify observations in Arep6.dta

.  sort ar_axis

.  drop _merge

.  merge using temp
(note: you are using old merge syntax; see [D] merge for new syntax)

.  set scheme lean1

.  label var aid_remit "Aid + Remit distribution"

.  sort ar_axis

.  drop _merge

.  
. twoway  (hist aid_remit if aid_remit<=26.5 & sumsam==1 & aid_remit>=0.5, lcolor(gs12) 
> bin(100)) /*
> */ (line PROB1aut ar_axis if ar_axis<=26.5, yaxis(1))  /*
> */ (line PROB2aut ar_axis if ar_axis<=26.5, yaxis(1))  /*
> */ (line PROB3aut ar_axis if ar_axis<=26.5, yaxis(1))  /*
> */ ,  xtitle("Aid + Remit (%GDP)", size(3.5)) ytitle("Pr(Failure)", size(3.5)) /*
> */  legend(pos(12) col(2) ring(1) label(1 "Aid + Remit distribution")  label(2 "All fa
> ilures") label(3 "Regime collapse") label(4 "No regime collapse"))  xscale(range (0 26
> )) xlabel(0 (5) 25)

. **graph export "C:\Users\jwright\Documents\My Dropbox\Research\Autocratic Instability\
> AhmedReplication.pdf", as(pdf)                            replace
. 
. twoway  (hist aid_remit if aid_remit<=26.5 & sumsam==1 & aid_remit>=0.5, lcolor(gs12) 
> bin(100)) /*
> */ (line PROB4aut ar_axis if ar_axis<=26.5, yaxis(1))  /*
> */ (line PROB5aut ar_axis if ar_axis<=26.5, yaxis(1))  /*
> */ (line PROB6aut ar_axis if ar_axis<=26.5, yaxis(1))  /*
> */ ,  xtitle("Aid + Remit (%GDP)", size(3.5)) ytitle("Pr(Failure)", size(3.5)) /*
> */  legend(pos(12) col(2) ring(1) label(1 "Aid + Remit distribution")  label(2 "All fa
> ilures") label(3 "Regime collapse") label(4 "No regime collapse"))  xscale(range (0 26
> )) xlabel(0 (5) 25)

. **graph export "C:\Users\jwright\Documents\My Dropbox\Research\Autocratic Instability\
> AhmedCorrected.pdf", as(pdf)                            replace
. 
. 
. 
. ******************************
. ** 95% Confidence Intervals **
. ******************************
. 
. twoway  (hist aid_remit if aid_remit<=26.5 & sumsam==1 & aid_remit>=0.5, lcolor(gs12) 
> bin(100)) /*
> */ (line PROB1aut PROB1autlow PROB1authigh ar_axis if ar_axis<=26.5, clpattern(solid d
> ash dash) yaxis(1)) /*
> */ ,  xtitle("Aid + Remit (%GDP)", size(4)) ytitle("Pr(Failure)", size(4)) /*
> */ legend(off)

. *graph export "C:\Users\jwright\Documents\My Dropbox\Research\Autocratic Instability\A
> hmedReplication_all95CI.pdf", as(pdf)                            replace
. 
. twoway  (hist aid_remit if aid_remit<=26.5 & sumsam==1 & aid_remit>=0.5, lcolor(gs12) 
> bin(100)) /*
> */ (line PROB2aut PROB2autlow PROB2authigh ar_axis if ar_axis<=26.5, clpattern(solid d
> ash dash) yaxis(1)) /*
> */ ,  xtitle("Aid + Remit (%GDP)", size(4)) ytitle("Pr(Failure)", size(4)) /*
> */ legend(off)

. *graph export "C:\Users\jwright\Documents\My Dropbox\Research\Autocratic Instability\A
> hmedReplication_fail95CI.pdf", as(pdf)                            replace
. 
. twoway  (hist aid_remit if aid_remit<=26.5 & sumsam==1 & aid_remit>=0.5, lcolor(gs12) 
> bin(100)) /*
> */ (line PROB3aut PROB3autlow PROB3authigh ar_axis if ar_axis<=26.5, clpattern(solid d
> ash dash) yaxis(1)) /*
> */ ,  xtitle("Aid + Remit (%GDP)", size(4)) ytitle("Pr(Failure)", size(4)) /*
> */ legend(off)

. *graph export "C:\Users\jwright\Documents\My Dropbox\Research\Autocratic Instability\A
> hmedReplication_nofail95CI.pdf", as(pdf)                            replace
. 
. twoway  (hist aid_remit if aid_remit<=26.5 & sumsam==1 & aid_remit>=0.5, lcolor(gs12) 
> bin(100)) /*
> */ (line PROB4aut PROB4autlow PROB4authigh ar_axis if ar_axis<=26.5, clpattern(solid d
> ash dash) yaxis(1)) /*
> */ ,  xtitle("Aid + Remit (%GDP)", size(4)) ytitle("Pr(Failure)", size(4)) /*
> */ legend(off)

. *graph export "C:\Users\jwright\Documents\My Dropbox\Research\Autocratic Instability\A
> hmedCorrected_all95CI.pdf", as(pdf)                            replace
. 
. twoway  (hist aid_remit if aid_remit<=26.5 & sumsam==1 & aid_remit>=0.5, lcolor(gs12) 
> bin(100)) /*
> */ (line PROB5aut PROB5autlow PROB5authigh ar_axis if ar_axis<=26.5, clpattern(solid d
> ash dash) yaxis(1)) /*
> */ ,  xtitle("Aid + Remit (%GDP)", size(4)) ytitle("Pr(Failure)", size(4)) /*
> */ legend(off)

. *graph export "C:\Users\jwright\Documents\My Dropbox\Research\Autocratic Instability\A
> hmedCorrected_fail95CI.pdf", as(pdf)                            replace
. 
. twoway  (hist aid_remit if aid_remit<=26.5 & sumsam==1 & aid_remit>=0.5, lcolor(gs12) 
> bin(100)) /*
> */ (line PROB6aut PROB6autlow PROB6authigh ar_axis if ar_axis<=26.5, clpattern(solid d
> ash dash) yaxis(1)) /*
> */ ,  xtitle("Aid + Remit (%GDP)", size(4)) ytitle("Pr(Failure)", size(4)) /*
> */ legend(off)

. *graph export "C:\Users\jwright\Documents\My Dropbox\Research\Autocratic Instability\A
> hmedCorrected_nofail95CI.pdf", as(pdf)                            replace
. 
. 
.  
. **********************************
. ** Ahmed 2012, Table 3 column 3 **
. **********************************
.  /* done separately in Stata 9 due to convergence issues; ivprobit are pretty unstable
>  with two endogenous variables/ better to use linear...
> use temp, clear
> global c = "finittrm lngdpcap ggdpcap lnpop ldis hdis time time2 time3 ydummy* asia af
> rica nam sam"
> global p = " sam ggdpcap time time2 lnpop lngdpcap war africa "
> 
>  **Replication model
>  qui ivprobit turnover (beta_AR=muslimoil) $c if sumsamp==1 , cluster(govtcode)
>  lincom beta_AR
>  est store c1
>  
>  **Use correctly lagged Autocracy score
>  qui ivprobit turnover (beta3_AR=muslimoil) $c if sumsamp==1 , cluster(govtcode)
>  lincom beta3_AR
>  est store c2
>  
>  **Use correctly lagged Autocracy score  and parsimonious specification
>         * Drops: time3, finitterm, asia, nam, ydummy*, ldis, and hdis
>  qui ivprobit turnover (beta3_AR   =muslimoil)  $p     if sumsamp==1 , cluster(govtcod
> e) difficult technique(bfgs)
>  lincom beta3_AR
>  est store c3
>  
>  **Use correctly lagged Autocracy score  and parsimonious specification and add consti
> tuent terms
>         * Drops: time3, finitterm, asia, nam, ydummy*, ldis, and hdis 
>  qui ivprobit turnover (beta3_AR aid_remit  =muslimoil beta3_muslim) beta3 $p   if sum
> samp==1 , cluster(govtcode) difficult technique(bfgs)
>  lincom beta3_AR
>  lincom aid_remit
>  lincom aid_remit + beta3_AR*0.048
>  lincom aid_remit + beta3_AR*0.5
>  est store c4
>  
>  **DPI fail and YES GWF fail: Use correctly lagged Autocracy score  and parsimonious s
> pecification and add constituent terms
>  qui ivprobit turnover2 (beta3_AR aid_remit  =muslimoil beta3_muslim)   beta3  $p    i
> f sumsamp==1 , cluster(govtcode) difficult technique(bfgs)
>  lincom beta3_AR
>  lincom aid_remit
>  lincom aid_remit + beta3_AR*0.048
>  lincom aid_remit + beta3_AR*0.5
>  est store c5
>  
>  **DPI fail and NO GWF fail: Use correctly lagged Autocracy score  and parsimonious sp
> ecification and add constituent terms
>  qui ivprobit turnover1 (beta3_AR aid_remit  =muslimoil beta3_muslim) beta3 $p    if s
> umsamp==1 , cluster(govtcode) difficult technique(bfgs)
>  lincom beta3_AR
>  lincom aid_remit
>  lincom aid_remit + beta3_AR*0.048
>  lincom aid_remit + beta3_AR*0.5
>  est store c6
> estout c1 c2 c3 c4 c5 c6 using TableC1.tex, cells(b(star  fmt(%9.3f)) se(par fmt(%9.2f
> ))) stats(ll r2 N) style(tex) replace label starlevels(* 0.10 ** 0.05)
> */
. 
.  *Double-check two-stage in a linear probability model: No results one way or another
.  global c = "finittrm lngdpcap ggdpcap lnpop ldis hdis time time2 time3 ydummy* asia a
> frica nam sam"

. 
.  qui ivreg2 turnover (aid_remit=muslimoil) $c if sumsamp==1, cluster(govtcode)    

.  lincom aid_remit

 ( 1)  aid_remit = 0

------------------------------------------------------------------------------
    turnover |      Coef.   Std. Err.      z    P>|z|     [95% Conf. Interval]
-------------+----------------------------------------------------------------
         (1) |  -.0097299   .0052583    -1.85   0.064     -.020036    .0005762
------------------------------------------------------------------------------

.  
.  qui ivreg2 turnover (beta3_AR aid_remit=muslimoil beta3_muslimoil) beta3_AR $c if sum
> samp==1, cluster(govtcode) 

.  lincom aid_remit + beta3_AR*.5

 ( 1)  aid_remit + .5*beta3_AR = 0

------------------------------------------------------------------------------
    turnover |      Coef.   Std. Err.      z    P>|z|     [95% Conf. Interval]
-------------+----------------------------------------------------------------
         (1) |  -.0011571   .0034772    -0.33   0.739    -.0079723    .0056582
------------------------------------------------------------------------------

.  lincom aid_remit + beta3_AR*1

 ( 1)  aid_remit + beta3_AR = 0

------------------------------------------------------------------------------
    turnover |      Coef.   Std. Err.      z    P>|z|     [95% Conf. Interval]
-------------+----------------------------------------------------------------
         (1) |   .0147662   .0140453     1.05   0.293    -.0127621    .0422945
------------------------------------------------------------------------------

.  
.  qui ivreg2 turnover2 (beta3_AR aid_remit=muslimoil beta3_muslimoil) beta3_AR $c if su
> msamp==1, cluster(govtcode)   

.  lincom aid_remit + beta3_AR*.5

 ( 1)  aid_remit + .5*beta3_AR = 0

------------------------------------------------------------------------------
   turnover2 |      Coef.   Std. Err.      z    P>|z|     [95% Conf. Interval]
-------------+----------------------------------------------------------------
         (1) |   .0011431   .0021096     0.54   0.588    -.0029916    .0052778
------------------------------------------------------------------------------

.  lincom aid_remit + beta3_AR*1

 ( 1)  aid_remit + beta3_AR = 0

------------------------------------------------------------------------------
   turnover2 |      Coef.   Std. Err.      z    P>|z|     [95% Conf. Interval]
-------------+----------------------------------------------------------------
         (1) |   .0113868   .0082276     1.38   0.166     -.004739    .0275126
------------------------------------------------------------------------------

.  
.  qui ivreg2 turnover1 (beta3_AR aid_remit=muslimoil beta3_muslimoil) beta3_AR $c if su
> msamp==1, cluster(govtcode)  

.  lincom aid_remit + beta3_AR*.5

 ( 1)  aid_remit + .5*beta3_AR = 0

------------------------------------------------------------------------------
   turnover1 |      Coef.   Std. Err.      z    P>|z|     [95% Conf. Interval]
-------------+----------------------------------------------------------------
         (1) |  -.0023001    .002076    -1.11   0.268     -.006369    .0017687
------------------------------------------------------------------------------

. lincom aid_remit + beta3_AR*1

 ( 1)  aid_remit + beta3_AR = 0

------------------------------------------------------------------------------
   turnover1 |      Coef.   Std. Err.      z    P>|z|     [95% Conf. Interval]
-------------+----------------------------------------------------------------
         (1) |   .0033794   .0090442     0.37   0.709    -.0143468    .0211056
------------------------------------------------------------------------------

. 
end of do-file

. 
. do Svolik

. **************************************************************************
. ** Svolik.do                                                            
. ** Joseph Wright & Daehee Bak                           
. ** Date created: November 19, 2015                                              
. ** Date updated: December 9, 2015
. **                                                                      
. ** Parent file:                                                         
. **     AutocraticInstability.do                                         
. **                                                                      
. ** Using data:                                                          
. **     SvolikLeaders.dta (Authoritarian Leader Spells, 1946 – 2008                    
>                                 
. **     SvolikCoalitions.dta (Authoritarian Ruling Coalition Spells, 1946 – 2008       
>         
. **       GWFglobal.dta                                  
. **************************************************************************
. 
. *****************************************
. ********** Svolik Comparison ************  
. *****************************************
. ** Compare Autocratic Leaders and Ruling Coalitions
. ** Reported stat I: 55% of leaderfailures entail NO RC failure
. ** Reported stat II: 42% of leaderfailure-years entail NO RC failure
.  
. 
. * Ruling Coalitions *
. use SvolikCoalitions, clear

. replace rc_end=17897 if ccode==510    /* recode from Dec 30 2008 to Dec 31 2008 so rig
> ht-censored */
(1 real change made)

. gen yr_s = year(rc_start)

. gen yr_e = year(rc_end)

. gen duration = yr_e -yr_s +1

. expand duration
(5,125 observations created)

. sort rc_id

. gen n = _n

. egen min =min(n), by(rc_id)

. gen year = yr_s  if n==min
(5,125 missing values generated)

. replace year = year[_n-1] + 1 if year==. & rc_id ==rc_id[_n-1]
(5,125 real changes made)

. gen rc_fail = year == yr_e 

. recode rc_fail (1=0) if  rc_end_exit=="."
(rc_fail: 63 changes made)

. gen rc_fail_type =  rc_end_exit if rc_fail ==1
(5,188 missing values generated)

. drop yr_* n min

. rename duration rc_duration

. tab rc_fail   /* 285 */

    rc_fail |      Freq.     Percent        Cum.
------------+-----------------------------------
          0 |      5,188       94.79       94.79
          1 |        285        5.21      100.00
------------+-----------------------------------
      Total |      5,473      100.00

. tab rc_fail  if rc_end~=17897 /* 284 RC failures */

    rc_fail |      Freq.     Percent        Cum.
------------+-----------------------------------
          0 |      3,150       91.73       91.73
          1 |        284        8.27      100.00
------------+-----------------------------------
      Total |      3,434      100.00

. egen m_rc_fail = max(rc_fail) if rc_end~=17897, by(ccode year)
(2039 missing values generated)

. egen tag = tag(ccode year)  if rc_end~=17897

. tab m_rc_fail if tag==1

  m_rc_fail |      Freq.     Percent        Cum.
------------+-----------------------------------
          0 |      3,042       92.29       92.29
          1 |        254        7.71      100.00
------------+-----------------------------------
      Total |      3,296      100.00

. drop tag m_rc_fail

. recode  rc_end (.= 18000) /* set censored to greater than max */
(rc_end: 0 changes made)

. gen ddate = rc_end

. sort ccode year ddate

. save temp, replace    /* 284 RC failures in 254 country-years */
file temp.dta saved

. 
. * Autocratic Leaders *
. use SvolikLeaders, clear

. gen stdate =date(startdate, "MDY", 2000)

. gen endate = date(enddate,  "MDY", 2000)

. gen yr_s = year(stdate)

. gen yr_e = year(endate)

. gen duration = yr_e -yr_s +1

. expand duration
(5,123 observations created)

. sort leadid

. gen n = _n

. egen min =min(n), by(leadid)

. gen year = yr_s  if n==min
(5,123 missing values generated)

. replace year = year[_n-1] + 1 if year==. & leadid ==leadid[_n-1]
(5,123 real changes made)

. gen leader_fail = year == yr_e 

. gen leader_fail_type =   exit if leader_fail ==1
(5,123 missing values generated)

. drop yr_* n min

. rename duration leader_dduration

. tab leader_fail /* 698 */

leader_fail |      Freq.     Percent        Cum.
------------+-----------------------------------
          0 |      5,123       88.01       88.01
          1 |        698       11.99      100.00
------------+-----------------------------------
      Total |      5,821      100.00

. tab leader_fail if endate~=17897

leader_fail |      Freq.     Percent        Cum.
------------+-----------------------------------
          0 |      4,293       87.11       87.11
          1 |        635       12.89      100.00
------------+-----------------------------------
      Total |      4,928      100.00

. egen m_leader_fail = max(leader_fail) if endate~=17897, by(ccode year)
(893 missing values generated)

. egen tag = tag(ccode year) if endate~=17897

. tab m_leader_fail if tag==1

m_leader_fa |
         il |      Freq.     Percent        Cum.
------------+-----------------------------------
          0 |      3,939       88.18       88.18
          1 |        528       11.82      100.00
------------+-----------------------------------
      Total |      4,467      100.00

. drop tag m_leader_fail

. recode  endate (.= 18000) /* set censored to greater than max */
(endate: 0 changes made)

. gen ddate =endate

. sort ccode year ddate  /* 635 leader failures in 528 country-years */

. 
. * Merge RC and leader data and compare *
. merge ccode year ddate using temp
(note: you are using old merge syntax; see [D] merge for new syntax)

. tab _merge

     _merge |      Freq.     Percent        Cum.
------------+-----------------------------------
          1 |      2,966       35.15       35.15
          2 |      2,618       31.02       66.17
          3 |      2,855       33.83      100.00
------------+-----------------------------------
      Total |      8,439      100.00

. rename _merge merge1

. gen rc_leader_fail = leader_fail
(2,618 missing values generated)

. sort ccode year ddate

. recode rc_leader_fail (1=0) if rc_end_leader~=leader
(rc_leader_fail: 351 changes made)

. tab rc_leader_fail leader_fail, col  /* 348 Ruling coalitions */

+-------------------+
| Key               |
|-------------------|
|     frequency     |
| column percentage |
+-------------------+

rc_leader_ |      leader_fail
      fail |         0          1 |     Total
-----------+----------------------+----------
         0 |     5,123        351 |     5,474 
           |    100.00      50.29 |     94.04 
-----------+----------------------+----------
         1 |         0        347 |       347 
           |      0.00      49.71 |      5.96 
-----------+----------------------+----------
     Total |     5,123        698 |     5,821 
           |    100.00     100.00 |    100.00 


. /* 55% of leaderfailures entail NO RC failure */
. tab rc_leader_fail leader_fail if endate~=17897 & rc_end~=17897, col  /* 285 Ruling co
> alition failures */

+-------------------+
| Key               |
|-------------------|
|     frequency     |
| column percentage |
+-------------------+

rc_leader_ |      leader_fail
      fail |         0          1 |     Total
-----------+----------------------+----------
         0 |     4,293        351 |     4,644 
           |    100.00      55.28 |     94.24 
-----------+----------------------+----------
         1 |         0        284 |       284 
           |      0.00      44.72 |      5.76 
-----------+----------------------+----------
     Total |     4,293        635 |     4,928 
           |    100.00     100.00 |    100.00 


. egen m_rc_fail= max(rc_fail) if endate~=17897 & rc_end~=17897 , by(ccode year)
(3270 missing values generated)

. egen m_leader_fail=max(leader_fail) if endate~=17897 & rc_end~=17897, by(ccode year)
(2039 missing values generated)

. egen tag = tag(ccode year) if endate~=17897 & rc_end~=17897

. /* 42% of leaderfailure years entail NO RC failure */
. tab m_* if tag==1,  col  

+-------------------+
| Key               |
|-------------------|
|     frequency     |
| column percentage |
+-------------------+

           |     m_leader_fail
 m_rc_fail |         0          1 |     Total
-----------+----------------------+----------
         0 |     2,859        183 |     3,042 
           |    100.00      41.88 |     92.29 
-----------+----------------------+----------
         1 |         0        254 |       254 
           |      0.00      58.12 |      7.71 
-----------+----------------------+----------
     Total |     2,859        437 |     3,296 
           |    100.00     100.00 |    100.00 


. drop tag

. 
. ****************************
. * Svolik -- GWF comparison *
. ****************************
. ** Compare GWF regime breakdowns and Svolik Ruling Coalition transitions
. ** Reported stat I: 97% of GWF regime breakdown country-years entail RC failure
. ** Reported stat II: 86% of RC transition country-years entail GWF regime breakdown
. gen cowcode = ccode

. sort cowcode year

. *recode m_rc_fail (1=0) if rc_end==17897  /* account for right-censored RC failures */
. merge cowcode year using GWFglobal
(note: you are using old merge syntax; see [D] merge for new syntax)
variables cowcode year do not uniquely identify observations in the master data

. tab _merge

     _merge |      Freq.     Percent        Cum.
------------+-----------------------------------
          1 |      1,430       11.95       11.95
          2 |      3,531       29.50       41.45
          3 |      7,009       58.55      100.00
------------+-----------------------------------
      Total |     11,970      100.00

. rename _merge merge2

. gen rc_start_yr = year(rc_start)
(6,497 missing values generated)

. gen rc_end_yr = year(rc_end)
(6,497 missing values generated)

. replace m_rc_fail=1 if year==rc_start_yr | year == rc_end_yr
(265 real changes made)

. egen max_gwf_fail = max(gwf_fail), by(cowcode year)
(1430 missing values generated)

. egen max_rc_fail = max(m_rc_fail), by(cowcode year)
(6640 missing values generated)

. egen max_leader_fail = max(m_leader_fail), by(cowcode year)
(4375 missing values generated)

. egen tag =tag(cowcode year)

. keep if tag==1
(3,128 observations deleted)

. recode max_rc_fail (1=0) if rc_end==17897  /* account for right-censored RC failures *
> /
(max_rc_fail: 72 changes made)

. recode max_rc_fail (0=1) if cow==438 & year==2008 /* new year's eve coup in Guinea 200
> 8 after Conte's death; not right-censored */
(max_rc_fail: 1 changes made)

. recode max_rc_fail (0=1) if cow==370 & year==1994 /* start of Lukashenka's regime in 1
> 994 is a transition in GWF and Svolik */
(max_rc_fail: 1 changes made)

. /*
> tab max_gwf_fail max_rc_fail if rc_id~=. & gwf_regime~="NA" ,row
> tab max_gwf_fail max_rc_fail if rc_id~=. & gwf_regime~="NA" ,col
> */
. 
. * 5 cases of GWF regime failure but no Svolik RC transition *
. tsset cow year
       panel variable:  cowcode (unbalanced)
        time variable:  year, 1921 to 2010, but with gaps
                delta:  1 unit

. gen rcfaill1fl =f.max_rc_fail==1 |  max_rc_fail==1

. tab  rcfaill1fl if rc_id~=. & gwf_regime~="NA" & max_gwf_fail==1  /* 97%*/

 rcfaill1fl |      Freq.     Percent        Cum.
------------+-----------------------------------
          0 |          5        3.18        3.18
          1 |        152       96.82      100.00
------------+-----------------------------------
      Total |        157      100.00

. list gwf_case year rc_start_leader rc_end_leader rc_start rc_end rcfaill1fl if rc_id~=
> . & gwf_regime~="NA" & max_gwf_fail==1 & rcfaill1fl==0, clean

          gwf_casename   year   rc_st~er   rc_end~er    rc_start      rc_end   rcfail~l 
>  
4009.      Niger 74-91   1991   Kountche      Seibou   17apr1974   16apr1993          0 
>  
4433.   Cameroon 60-83   1983     Ahidjo        Biya   01jan1960   31dec2008          0 
>  
6337.      Syria 46-47   1947    Kuwatli     Kuwatli   17aug1943   30mar1949          0 
>  
6341.      Syria 49-51   1951    Hinnawi   Shishakli   13aug1949   28feb1954          0 
>  
8140.   Cambodia 53-70   1970   Sihanouk     Lon Nol   09nov1953   01apr1975          0 
>  

. list gwf_case year rc_start_leader rc_end_leader rc_start rc_end  if rc_id~=. & gwf_re
> gime~="NA" & max_gwf_fail==1 & rcfaill1fl==1 & max_rc_fail==0, clean

              gwf_casename   year   rc_start_lea~r      rc_end_leader    rc_start      r
> c_end  
 462.      Guatemala 70-85   1985       Rios Montt     Mejia Victores   23mar1982   14ja
> n1986  
 536.       Honduras 72-81   1981   Lopez Arellano         Paz Garcia   04dec1972   27ja
> n1982  
 817.         Panama 82-89   1989    Dario Paredes            Noriega   03mar1982   03ja
> n1990  
1387.          Chile 73-89   1989         Pinochet           Pinochet   11sep1973   11ma
> r1990  
1512.        Uruguay 73-84   1984       Bordaberry   Alvarez Armalino   01mar1972   01ma
> r1985  
2292.         Poland 44-89   1989           Bierut         Jaruzelski   31dec1944   22de
> c1990  
2640.        Albania 44-91   1991            Hoxha               Alia   29nov1944   03ap
> r1992  
3906.          Benin 72-90   1990          Kerekou            Kerekou   27oct1972   04ap
> r1991  
4694.      Congo-Brz 68-91   1991          Ngouabi            Nguesso   01jan1969   20au
> g1992  
7503.   Korea, South 61-87   1987    Chon Too Hwan      Chon Too Hwan   12dec1979   25fe
> b1988  

. 
. * 24 cases of Svolik RC transition but no GWF regime failure*
. tsset cow year
       panel variable:  cowcode (unbalanced)
        time variable:  year, 1921 to 2010, but with gaps
                delta:  1 unit

. gen gwffaill1fl =l.max_gwf_fail==1 | f.max_gwf_fail==1 |  max_gwf_fail==1

. tab gwffaill1fl if rc_id~=. & gwf_regime~="NA" & gwf_regime~="" & max_rc_fail ==1,  /*
>  86% */

gwffaill1fl |      Freq.     Percent        Cum.
------------+-----------------------------------
          0 |         24       13.56       13.56
          1 |        153       86.44      100.00
------------+-----------------------------------
      Total |        177      100.00

.    list gwf_case year rc_start_leader rc_end_leader rc_start rc_end if rc_id~=. & gwf_
> regime~="NA" & gwf_regime~="" & max_rc_fail==1 & gwffaill1fl==0, clean

              gwf_casename   year         rc_start_leader            rc_end_leader    rc
> _start      rc_end  
 256.          Haiti 99-04   2001                  Preval                   Preval   07f
> eb1996   07feb2001  
 581.    El Salvador 48-82   1960                 Cordova                    Lemus   15d
> ec1948   26oct1960  
 582.    El Salvador 48-82   1961                Castillo                 Castillo   26o
> ct1960   25jan1961  
 583.    El Salvador 48-82   1962                Portillo                 Portillo   25j
> an1961   25jan1962  
 600.    El Salvador 48-82   1979                  Rivera              Romero Mena   01j
> ul1962   15oct1979  
1040.        Ecuador 72-79   1976          Rodriguez Lara           Rodriguez Lara   15f
> eb1972   11jan1976  
1425.      Argentina 58-66   1962                   Guido                    Guido   29m
> ar1962   12oct1963  
1426.      Argentina 58-66   1963                   Guido                    Guido   29m
> ar1962   12oct1963  
2390.        Hungary 47-90   1956                  Rakosi                   Rakosi   15j
> an1945   15jul1956  
4147.   Burkina Faso 66-80   1974                Lamizana   Gerard Kango Ouedraogo   03j
> an1966   08feb1974  
4341.          Ghana 81-00   1993                Rawlings                 Rawlings   31d
> ec1981   07jan1993  
4515.          Gabon 60-NA   1964                     Mba                      Mba   17a
> ug1960   17feb1964  
4718.    Congo/Zaire 60-97   1965                  Mobutu                   Mobutu   25n
> ov1965   16may1997  
4925.        Burundi 66-87   1976               Mwambutsa                Micombero   01j
> ul1962   01nov1976  
5399.   South Africa 10-94   1948                   Smuts                    Smuts   06s
> ep1939   03jun1948  
5862.        Algeria 92-NA   1999                 Boudiaf                  Zeroual   14j
> an1992   27apr1999  
6053.           Iran 25-79   1951   Mohammad Shah Pahlavi    Mohammad Shah Pahlavi   16s
> ep1941   30apr1951  
6055.           Iran 25-79   1953       Mohammad Mossadeg        Mohammad Mossadeg   30a
> pr1951   19aug1953  
6831.         Kuwait 61-NA   1990       Abdullah As-Sabah           Jabir As-Sabah   29j
> an1950   02aug1990  
7073.    Afghanistan 78-92   1986              Najibullah               Najibullah   05m
> ay1986   16apr1992  
7495.   Korea, South 61-87   1979           Park Chung Hi            Park Chung Hi   03j
> ul1961   26oct1979  
7916.      Sri Lanka 78-94   1989             Jayewardene              Jayewardene   23j
> an1977   02jan1989  
8155.       Cambodia 79-NA   1985                 Hun Sen                  Hun Sen   14j
> an1985   15oct1991  
8161.       Cambodia 79-NA   1991                 Hun Sen                  Hun Sen   14j
> an1985   15oct1991  

.    list gwf_case year rc_start_leader rc_end_leader rc_start rc_end  if rc_id~=. & gwf
> _regime~="NA" & max_rc_fail==1 & gwffaill1fl==1 & max_gwf_fail==0, clean

            gwf_casename   year   rc_start_leader     rc_end_leader    rc_start      rc_
> end  
 434.    Guatemala 54-58   1957            Monzon    Castillo Armas   29jun1954   20jul1
> 957  
 463.    Guatemala 85-95   1986        Rios Montt    Mejia Victores   23mar1982   14jan1
> 986  
 850.     Colombia 53-58   1957    Laureano Gomez    Rojas Pinillia   07aug1950   10may1
> 957  
1232.      Bolivia 69-71   1970     Ovando Candia     Ovando Candia   26sep1969   06oct1
> 970  
2942.     Bulgaria 44-90   1989          Georgiev           Zhivkov   09sep1944   10nov1
> 989  
4672.    Congo-Brz 68-91   1969             Debat             Raoul   16aug1963   01jan1
> 969  
7784.   Bangladesh 75-82   1981             Sayem      Ziaur Rahman   06nov1975   20may1
> 981  
8035.        Nepal 51-91   1990        Padma Rana          Birendra   28nov1945   19apr1
> 990  
8058.     Thailand 44-47   1946   Pridi Panymyong   Pridi Panymyong   02aug1944   21aug1
> 946  
8089.     Thailand 76-88   1977            Sangad            Sangad   06oct1976   21oct1
> 977  
8591.    Indonesia 66-99   1998           Suharto           Suharto   12mar1966   21may1
> 998  

. 
. 
.    
. 
. 
. ******************************************
. **********Morrison Replication************
. ******************************************
. use temp_Polity, clear

. count
  18,094

. merge cowcode year using svolik_merge
(note: you are using old merge syntax; see [D] merge for new syntax)
(note: variable cowcode was int, now float to accommodate using data's values)
(note: variable year was int, now float to accommodate using data's values)

. tab _merge

     _merge |      Freq.     Percent        Cum.
------------+-----------------------------------
          1 |     13,450       74.08       74.08
          2 |         61        0.34       74.42
          3 |      4,644       25.58      100.00
------------+-----------------------------------
      Total |     18,155      100.00

. drop if _merge==2
(61 observations deleted)

. drop _merge

. tsset cowcode year
       panel variable:  cowcode (unbalanced)
        time variable:  year, 1800 to 2011, but with gaps
                delta:  1 unit

. 
. 
. *DV* 
. 
. gen durafail1 = poldv
(12,341 missing values generated)

. replace durafail1 = 0 if gwf_fail==1   /* durable failures with no GWF regime failure 
> */
(270 real changes made)

. 
. gen durafail2 = poldv
(12,341 missing values generated)

. replace durafail2 = 0 if gwf_fail==0 | (gwf_fail==. & poldv==1) /* durable failures wi
> th GWF regime failure */
(3,035 real changes made)

. 
. /* durable failure + ruling coalition failure */
. gen poldv_rcfail = .
(18,094 missing values generated)

. replace poldv_rcfail = durafail2 if spell_id==.
(3,983 real changes made)

. replace poldv_rcfail = 0 if poldv==0 & spell_id~=.
(2,922 real changes made)

. replace poldv_rcfail = 1 if poldv==1 & svolik_RC==1 & spell_id~=.
(87 real changes made)

. replace poldv_rcfail = 0 if poldv==1 & svolik_RC==0 & spell_id~=.
(241 real changes made)

. /* durable failure + no ruling coalition failure */
. gen poldv_norcfail = .  
(18,094 missing values generated)

. replace poldv_norcfail = durafail1 if spell_id==.
(2,532 real changes made)

. replace poldv_norcfail = 0 if poldv==0 & spell_id~=.
(2,922 real changes made)

. replace poldv_norcfail = 1 if poldv==1 & svolik_RC==0 & spell_id~=.
(241 real changes made)

. replace poldv_norcfail = 0 if poldv==1 & svolik_RC==1 & spell_id~=.
(87 real changes made)

. 
. 
. *Replication of Model 2, Table 3
. logit poldv nt gdpgrowth l.lnincome d.urbanpop elf  l.lnpopdens l.pastpolitydv politya
> ge polityageknot1 polityageknot2 if l.polity~=-77 & polity~=-77 & polity2~=-77 & l.pol
> ity2~=-77, cluster(bankscode)

Iteration 0:   log pseudolikelihood = -392.31748  
Iteration 1:   log pseudolikelihood = -369.61998  
Iteration 2:   log pseudolikelihood = -325.29463  
Iteration 3:   log pseudolikelihood =  -322.7273  
Iteration 4:   log pseudolikelihood =  -322.5035  
Iteration 5:   log pseudolikelihood =  -322.5005  
Iteration 6:   log pseudolikelihood =  -322.5005  

Logistic regression                             Number of obs     =      1,808
                                                Wald chi2(10)     =     125.24
                                                Prob > chi2       =     0.0000
Log pseudolikelihood =  -322.5005               Pseudo R2         =     0.1780

                              (Std. Err. adjusted for 104 clusters in bankscode)
--------------------------------------------------------------------------------
               |               Robust
         poldv |      Coef.   Std. Err.      z    P>|z|     [95% Conf. Interval]
---------------+----------------------------------------------------------------
            nt |  -.6607784   .2286653    -2.89   0.004    -1.108954   -.2126026
     gdpgrowth |   -.056452   .0199745    -2.83   0.005    -.0956012   -.0173027
               |
      lnincome |
           L1. |  -.1922178   .1059463    -1.81   0.070    -.3998688    .0154332
               |
      urbanpop |
           D1. |   .5699208   .2490988     2.29   0.022     .0816961    1.058145
               |
           elf |  -.0314755   .5412132    -0.06   0.954    -1.092234    1.029283
               |
     lnpopdens |
           L1. |   -.016125   .0894254    -0.18   0.857    -.1913955    .1591455
               |
  pastpolitydv |
           L1. |  -.0109314   .0559308    -0.20   0.845    -.1205537    .0986909
               |
     polityage |  -.3703636   .0561857    -6.59   0.000    -.4804856   -.2602416
polityageknot1 |   .0013052   .0002299     5.68   0.000     .0008547    .0017558
polityageknot2 |  -.0000554   .0000199    -2.79   0.005    -.0000944   -.0000165
         _cons |    .420455   .9691396     0.43   0.664    -1.479024    2.319934
--------------------------------------------------------------------------------

. estimates store m1

. lroc, nograph

Logistic model for poldv

number of observations =     1808
area under ROC curve   =   0.8095

. tab poldv if s

      poldv |      Freq.     Percent        Cum.
------------+-----------------------------------
          0 |      1,706       94.36       94.36
          1 |        102        5.64      100.00
------------+-----------------------------------
      Total |      1,808      100.00

. 
. **************************
. *** JW additions begin ***
. **************************
. * code Guatemala 1974 as NO ruling coalition failure b/c no GWF fail (not in Svolik sa
> mple) *
. recode poldv_rcfail (.=0) if s==1 & cow==90
(poldv_rcfail: 1 changes made)

. recode poldv_norcfail (.=1) if s==1 & cow==90
(poldv_norcfail: 1 changes made)

. 
. * code Indonesia 1999 as ruling coalition failure since we code multiyear Polity failu
> res that coincide with Svolik or GWF **
. recode poldv_rcfail (.=1) if s==1 & cow==850
(poldv_rcfail: 1 changes made)

. recode poldv_norcfail (.=0) if s==1 & cow==850
(poldv_norcfail: 1 changes made)

. ************************
. *** JW additions end ***
. ************************
. 
. *Model 2, Table 3 (durable failure + ruling coalition failure)
. xi: logit poldv_rcfail nt gdpgrowth l.lnincome d.urbanpop elf  l.lnpopdens l.pastpolit
> ydv polityage polityageknot1 polityageknot2 if l.polity~=-77 & polity~=-77 & polity2~=
> -77 & l.polity2~=-77, cluster(bankscode)

Iteration 0:   log pseudolikelihood = -152.71309  
Iteration 1:   log pseudolikelihood = -145.99394  
Iteration 2:   log pseudolikelihood =  -136.4057  
Iteration 3:   log pseudolikelihood = -135.80978  
Iteration 4:   log pseudolikelihood = -135.66667  
Iteration 5:   log pseudolikelihood = -135.65816  
Iteration 6:   log pseudolikelihood = -135.65811  
Iteration 7:   log pseudolikelihood = -135.65811  

Logistic regression                             Number of obs     =      1,808
                                                Wald chi2(10)     =      51.03
                                                Prob > chi2       =     0.0000
Log pseudolikelihood = -135.65811               Pseudo R2         =     0.1117

                              (Std. Err. adjusted for 104 clusters in bankscode)
--------------------------------------------------------------------------------
               |               Robust
  poldv_rcfail |      Coef.   Std. Err.      z    P>|z|     [95% Conf. Interval]
---------------+----------------------------------------------------------------
            nt |  -.6208166   .2653401    -2.34   0.019    -1.140874   -.1007596
     gdpgrowth |  -.0758707   .0489122    -1.55   0.121     -.171737    .0199955
               |
      lnincome |
           L1. |   .0124279   .1790365     0.07   0.945    -.3384772    .3633329
               |
      urbanpop |
           D1. |   .6956356   .4367187     1.59   0.111    -.1603174    1.551589
               |
           elf |   .4827924   1.038713     0.46   0.642    -1.553047    2.518632
               |
     lnpopdens |
           L1. |   .1729966   .1581844     1.09   0.274     -.137039    .4830322
               |
  pastpolitydv |
           L1. |   .0710815    .067212     1.06   0.290    -.0606516    .2028147
               |
     polityage |  -.2205399   .0959612    -2.30   0.022    -.4086205   -.0324594
polityageknot1 |   .0007985   .0004044     1.97   0.048     5.91e-06    .0015911
polityageknot2 |   -.000058   .0000367    -1.58   0.114    -.0001299     .000014
         _cons |  -4.084799    1.68456    -2.42   0.015    -7.386477   -.7831218
--------------------------------------------------------------------------------
Note: 26 failures and 0 successes completely determined.

. estimates store m2

. lroc, nograph

Logistic model for poldv_rcfail

number of observations =     1808
area under ROC curve   =   0.7933

. tab poldv poldv_rcfail if e(sample)

           |     poldv_rcfail
     poldv |         0          1 |     Total
-----------+----------------------+----------
         0 |     1,706          0 |     1,706 
         1 |        72         30 |       102 
-----------+----------------------+----------
     Total |     1,778         30 |     1,808 


. 
. *Model 2, Table 3 (durable failure + no ruling coalition failure)
. xi: logit poldv_norcfail nt gdpgrowth l.lnincome d.urbanpop elf  l.lnpopdens l.pastpol
> itydv polityage polityageknot1 polityageknot2 if l.polity~=-77 & polity~=-77 & polity2
> ~=-77 & l.polity2~=-77, cluster(bankscode)

Iteration 0:   log pseudolikelihood =  -302.6253  
Iteration 1:   log pseudolikelihood = -299.04996  
Iteration 2:   log pseudolikelihood = -248.96186  
Iteration 3:   log pseudolikelihood = -246.62426  
Iteration 4:   log pseudolikelihood = -246.48416  
Iteration 5:   log pseudolikelihood = -246.48274  
Iteration 6:   log pseudolikelihood = -246.48274  

Logistic regression                             Number of obs     =      1,808
                                                Wald chi2(10)     =     125.93
                                                Prob > chi2       =     0.0000
Log pseudolikelihood = -246.48274               Pseudo R2         =     0.1855

                              (Std. Err. adjusted for 104 clusters in bankscode)
--------------------------------------------------------------------------------
               |               Robust
poldv_norcfail |      Coef.   Std. Err.      z    P>|z|     [95% Conf. Interval]
---------------+----------------------------------------------------------------
            nt |  -.6321592    .247763    -2.55   0.011    -1.117766   -.1465525
     gdpgrowth |  -.0426849   .0180896    -2.36   0.018    -.0781397     -.00723
               |
      lnincome |
           L1. |  -.2829897   .1500933    -1.89   0.059    -.5771672    .0111877
               |
      urbanpop |
           D1. |     .45425   .3225062     1.41   0.159    -.1778506    1.086351
               |
           elf |  -.1919489   .5943847    -0.32   0.747    -1.356921    .9730237
               |
     lnpopdens |
           L1. |  -.1073891     .10677    -1.01   0.315    -.3166545    .1018764
               |
  pastpolitydv |
           L1. |   -.058837   .0807249    -0.73   0.466     -.217055    .0993809
               |
     polityage |  -.4260981   .0598332    -7.12   0.000     -.543369   -.3088272
polityageknot1 |   .0015107   .0002521     5.99   0.000     .0010166    .0020048
polityageknot2 |  -.0000601   .0000225    -2.67   0.008    -.0001042   -.0000159
         _cons |   1.346661   1.241049     1.09   0.278     -1.08575    3.779072
--------------------------------------------------------------------------------

. estimates store m3

. lroc, nograph

Logistic model for poldv_norcfail

number of observations =     1808
area under ROC curve   =   0.8200

. tab poldv poldv_norcfail if e(sample)

           |    poldv_norcfail
     poldv |         0          1 |     Total
-----------+----------------------+----------
         0 |     1,706          0 |     1,706 
         1 |        30         72 |       102 
-----------+----------------------+----------
     Total |     1,736         72 |     1,808 


. 
. 
. 
. **************************
. *** JW additions begin ***
. **************************
. *** Twice logged non-tax revenue ***  this shows that the correlation is strongest for
>  Svolik RC failures, less so for poldv that is not Svolik RC failure
. gen lnt = ln(1+abs(nt))
(16,061 missing values generated)

. gen l2nt = ln(1+abs(lnt))
(16,061 missing values generated)

. replace l2nt = l2nt*-1 if nt<0
(62 real changes made)

. hist l2nt if s==1
(bin=32, start=-.91216165, width=.07032677)

. 
. xi: logit poldv_rcfail l2nt gdpgrowth l.lnincome d.urbanpop elf  l.lnpopdens l.pastpol
> itydv polityage polityageknot1 polityageknot2 if l.polity~=-77 & polity~=-77 & polity2
> ~=-77 & l.polity2~=-77, cluster(bankscode)

Iteration 0:   log pseudolikelihood = -152.71309  
Iteration 1:   log pseudolikelihood = -145.92532  
Iteration 2:   log pseudolikelihood = -136.83461  
Iteration 3:   log pseudolikelihood = -136.24899  
Iteration 4:   log pseudolikelihood = -136.10948  
Iteration 5:   log pseudolikelihood = -136.10131  
Iteration 6:   log pseudolikelihood = -136.10126  
Iteration 7:   log pseudolikelihood = -136.10126  

Logistic regression                             Number of obs     =      1,808
                                                Wald chi2(10)     =      51.28
                                                Prob > chi2       =     0.0000
Log pseudolikelihood = -136.10126               Pseudo R2         =     0.1088

                              (Std. Err. adjusted for 104 clusters in bankscode)
--------------------------------------------------------------------------------
               |               Robust
  poldv_rcfail |      Coef.   Std. Err.      z    P>|z|     [95% Conf. Interval]
---------------+----------------------------------------------------------------
          l2nt |  -1.495173   .7276292    -2.05   0.040      -2.9213   -.0690461
     gdpgrowth |  -.0762384   .0471132    -1.62   0.106    -.1685785    .0161017
               |
      lnincome |
           L1. |    .024936   .1878071     0.13   0.894    -.3431591    .3930311
               |
      urbanpop |
           D1. |   .7088108   .4267807     1.66   0.097    -.1276641    1.545286
               |
           elf |   .4173737   1.039992     0.40   0.688    -1.620974    2.455721
               |
     lnpopdens |
           L1. |   .1550978   .1559634     0.99   0.320    -.1505849    .4607804
               |
  pastpolitydv |
           L1. |   .0689025   .0676403     1.02   0.308      -.06367    .2014751
               |
     polityage |  -.2200881   .0958293    -2.30   0.022      -.40791   -.0322662
polityageknot1 |   .0007906   .0004045     1.95   0.051    -2.28e-06    .0015834
polityageknot2 |  -.0000571   .0000372    -1.54   0.124      -.00013    .0000158
         _cons |  -4.003504   1.724781    -2.32   0.020    -7.384013   -.6229961
--------------------------------------------------------------------------------
Note: 26 failures and 0 successes completely determined.

. estimates store m4

. lroc, nograph

Logistic model for poldv_rcfail

number of observations =     1808
area under ROC curve   =   0.7900

. xi: logit poldv_norcfail l2nt gdpgrowth l.lnincome d.urbanpop elf  l.lnpopdens l.pastp
> olitydv polityage polityageknot1 polityageknot2 if l.polity~=-77 & polity~=-77 & polit
> y2~=-77 & l.polity2~=-77, cluster(bankscode)

Iteration 0:   log pseudolikelihood =  -302.6253  
Iteration 1:   log pseudolikelihood = -299.45217  
Iteration 2:   log pseudolikelihood = -249.47395  
Iteration 3:   log pseudolikelihood = -247.64239  
Iteration 4:   log pseudolikelihood = -247.52275  
Iteration 5:   log pseudolikelihood =  -247.5215  
Iteration 6:   log pseudolikelihood =  -247.5215  

Logistic regression                             Number of obs     =      1,808
                                                Wald chi2(10)     =     118.53
                                                Prob > chi2       =     0.0000
Log pseudolikelihood =  -247.5215               Pseudo R2         =     0.1821

                              (Std. Err. adjusted for 104 clusters in bankscode)
--------------------------------------------------------------------------------
               |               Robust
poldv_norcfail |      Coef.   Std. Err.      z    P>|z|     [95% Conf. Interval]
---------------+----------------------------------------------------------------
          l2nt |  -.9000406    .790789    -1.14   0.255    -2.449959    .6498775
     gdpgrowth |  -.0431574   .0180878    -2.39   0.017    -.0786089   -.0077059
               |
      lnincome |
           L1. |  -.3122421   .1691782    -1.85   0.065    -.6438253     .019341
               |
      urbanpop |
           D1. |   .4976524   .3228911     1.54   0.123    -.1352025    1.130507
               |
           elf |  -.2258101   .5902186    -0.38   0.702    -1.382617     .930997
               |
     lnpopdens |
           L1. |  -.1156606   .1062673    -1.09   0.276    -.3239407    .0926196
               |
  pastpolitydv |
           L1. |   -.063612   .0810585    -0.78   0.433    -.2224837    .0952598
               |
     polityage |  -.4244142   .0596311    -7.12   0.000     -.541289   -.3075395
polityageknot1 |   .0014945   .0002507     5.96   0.000     .0010031    .0019859
polityageknot2 |  -.0000584   .0000228    -2.57   0.010     -.000103   -.0000138
         _cons |   1.599585    1.29584     1.23   0.217    -.9402152    4.139384
--------------------------------------------------------------------------------

. estimates store m5

. lroc, nograph

Logistic model for poldv_norcfail

number of observations =     1808
area under ROC curve   =   0.8173

. ************************
. *** JW additions end ***
. ************************
. estout m1 m2 m3 using TableG1.tex, cells(b(star  fmt(%9.3f)) se(par fmt(%9.2f))) stats
> (ll r2 N) style(tex) replace label starlevels(* 0.10 ** 0.05)
(output written to TableG1.tex)

. saveold temp_Morrison_Svolik, replace
(saving in Stata 13 format)
(FYI, saveold has options version(12) and version(11) that write files in older Stata
      formats)
file temp_Morrison_Svolik.dta saved

. 
. 
. 
. *****************
. ***Simulations***
. *****************
. 
. use temp_Morrison_Svolik, clear

. set more off

. logit poldv nt gdpgrowth l.lnincome d.urbanpop elf  l.lnpopdens l.pastpolitydv politya
> ge polityageknot1 polityageknot2 if s, cluster(bankscode)

Iteration 0:   log pseudolikelihood = -392.31748  
Iteration 1:   log pseudolikelihood = -369.61998  
Iteration 2:   log pseudolikelihood = -325.29463  
Iteration 3:   log pseudolikelihood =  -322.7273  
Iteration 4:   log pseudolikelihood =  -322.5035  
Iteration 5:   log pseudolikelihood =  -322.5005  
Iteration 6:   log pseudolikelihood =  -322.5005  

Logistic regression                             Number of obs     =      1,808
                                                Wald chi2(10)     =     125.24
                                                Prob > chi2       =     0.0000
Log pseudolikelihood =  -322.5005               Pseudo R2         =     0.1780

                              (Std. Err. adjusted for 104 clusters in bankscode)
--------------------------------------------------------------------------------
               |               Robust
         poldv |      Coef.   Std. Err.      z    P>|z|     [95% Conf. Interval]
---------------+----------------------------------------------------------------
            nt |  -.6607784   .2286653    -2.89   0.004    -1.108954   -.2126026
     gdpgrowth |   -.056452   .0199745    -2.83   0.005    -.0956012   -.0173027
               |
      lnincome |
           L1. |  -.1922178   .1059463    -1.81   0.070    -.3998688    .0154332
               |
      urbanpop |
           D1. |   .5699208   .2490988     2.29   0.022     .0816961    1.058145
               |
           elf |  -.0314755   .5412132    -0.06   0.954    -1.092234    1.029283
               |
     lnpopdens |
           L1. |   -.016125   .0894254    -0.18   0.857    -.1913955    .1591455
               |
  pastpolitydv |
           L1. |  -.0109314   .0559308    -0.20   0.845    -.1205537    .0986909
               |
     polityage |  -.3703636   .0561857    -6.59   0.000    -.4804856   -.2602416
polityageknot1 |   .0013052   .0002299     5.68   0.000     .0008547    .0017558
polityageknot2 |  -.0000554   .0000199    -2.79   0.005    -.0000944   -.0000165
         _cons |    .420455   .9691396     0.43   0.664    -1.479024    2.319934
--------------------------------------------------------------------------------

. drawnorm b1-b11, n(10000) means(e(b)) cov(e(V))  clear 
(obs 10,000)

. gen PROBa=.
(10,000 missing values generated)

. gen PROBalow=.
(10,000 missing values generated)

. gen PROBahigh=.
(10,000 missing values generated)

. gen a =.
(10,000 missing values generated)

. gen nt_axis = (_n-1)/50 + 0 if _n<=118
(9,882 missing values generated)

. /*We want nt to run from 0 to 2.36, ie from 5pctile to 95pctile*/ 
. local a=0

. while `a' <= 2.36 {
  2.         gen x_beta  = b1*`a'+b2*3.48+b3*8.06+b4*0.4+b5*0.42+b6*3.95+b7*1.86+b8*28+b
> 9*7819+b10*33139+b11*1
  3.         gen prob = invlogit(x_beta)
  4.         egen probhat=mean(prob)
  5.       _pctile prob, p(2.5,97.5) 
  6.       scalar problow= r(r1) 
  7.       scalar probhigh= r(r2)
  8.         quietly replace a = `a' 
  9.         quietly replace PROBa =  probhat  if nt_axis==a
 10.         quietly replace PROBalow =  problow  if nt_axis==a
 11.         quietly replace PROBahigh =  probhigh  if nt_axis==a
 12.         drop x_beta prob* probhat* 
 13.         local a = `a' + .02
 14. }

. label var nt_axis "Non-tax revenue per capita (rescaled)"

. label var PROBa "Replication"

. sort nt_axis

. save Mrep1, replace
file Mrep1.dta saved

. 
. 
. use temp_Morrison_Svolik, clear

. set more off

. logit poldv_rcfail nt gdpgrowth l.lnincome d.urbanpop elf  l.lnpopdens l.pastpolitydv 
> polityage polityageknot1 polityageknot2 if l.polity~=-77 & polity~=-77 & polity2~=-77 
> & l.polity2~=-77, cluster(bankscode)

Iteration 0:   log pseudolikelihood = -152.71309  
Iteration 1:   log pseudolikelihood = -145.99394  
Iteration 2:   log pseudolikelihood =  -136.4057  
Iteration 3:   log pseudolikelihood = -135.80978  
Iteration 4:   log pseudolikelihood = -135.66667  
Iteration 5:   log pseudolikelihood = -135.65816  
Iteration 6:   log pseudolikelihood = -135.65811  
Iteration 7:   log pseudolikelihood = -135.65811  

Logistic regression                             Number of obs     =      1,808
                                                Wald chi2(10)     =      51.03
                                                Prob > chi2       =     0.0000
Log pseudolikelihood = -135.65811               Pseudo R2         =     0.1117

                              (Std. Err. adjusted for 104 clusters in bankscode)
--------------------------------------------------------------------------------
               |               Robust
  poldv_rcfail |      Coef.   Std. Err.      z    P>|z|     [95% Conf. Interval]
---------------+----------------------------------------------------------------
            nt |  -.6208166   .2653401    -2.34   0.019    -1.140874   -.1007596
     gdpgrowth |  -.0758707   .0489122    -1.55   0.121     -.171737    .0199955
               |
      lnincome |
           L1. |   .0124279   .1790365     0.07   0.945    -.3384772    .3633329
               |
      urbanpop |
           D1. |   .6956356   .4367187     1.59   0.111    -.1603174    1.551589
               |
           elf |   .4827924   1.038713     0.46   0.642    -1.553047    2.518632
               |
     lnpopdens |
           L1. |   .1729966   .1581844     1.09   0.274     -.137039    .4830322
               |
  pastpolitydv |
           L1. |   .0710815    .067212     1.06   0.290    -.0606516    .2028147
               |
     polityage |  -.2205399   .0959612    -2.30   0.022    -.4086205   -.0324594
polityageknot1 |   .0007985   .0004044     1.97   0.048     5.91e-06    .0015911
polityageknot2 |   -.000058   .0000367    -1.58   0.114    -.0001299     .000014
         _cons |  -4.084799    1.68456    -2.42   0.015    -7.386477   -.7831218
--------------------------------------------------------------------------------
Note: 26 failures and 0 successes completely determined.

. drawnorm b1-b11, n(10000) means(e(b)) cov(e(V))  clear 
(obs 10,000)

. gen PROBb=.
(10,000 missing values generated)

. gen PROBblow=.
(10,000 missing values generated)

. gen PROBbhigh=.
(10,000 missing values generated)

. gen a =.
(10,000 missing values generated)

. gen nt_axis = (_n-1)/50 + 0 if _n<=118
(9,882 missing values generated)

. /*We want nt to run from 0 to 2.36, ie from 5pctile to 95pctile*/ 
. local a=0

. while `a' <= 2.36 {
  2.         gen x_beta  = b1*`a'+b2*3.48+b3*8.06+b4*0.4+b5*0.42+b6*3.95+b7*1.86+b8*28+b
> 9*7819+b10*33139+b11*1
  3.         gen prob = invlogit(x_beta)
  4.         egen probhat=mean(prob)
  5.       _pctile prob, p(2.5,97.5) 
  6.       scalar problow= r(r1) 
  7.       scalar probhigh= r(r2) 
  8.         quietly replace a = `a' 
  9.         quietly replace PROBb =  probhat  if nt_axis==a
 10.         quietly replace PROBblow =  problow  if nt_axis==a
 11.         quietly replace PROBbhigh =  probhigh  if nt_axis==a
 12.         drop x_beta prob* probhat* 
 13.         local a = `a' + .02
 14. }

. label var nt_axis "Non-tax revenue per capita (rescaled)"

. label var PROBb "Regime transition with ruling coalition failure"

. sort nt_axis

. save Mrep2, replace
file Mrep2.dta saved

. 
. 
. use temp_Morrison_Svolik, clear

. set more off

. logit poldv_norcfail nt gdpgrowth l.lnincome d.urbanpop elf  l.lnpopdens l.pastpolityd
> v polityage polityageknot1 polityageknot2 if l.polity~=-77 & polity~=-77 & polity2~=-7
> 7 & l.polity2~=-77, cluster(bankscode)

Iteration 0:   log pseudolikelihood =  -302.6253  
Iteration 1:   log pseudolikelihood = -299.04996  
Iteration 2:   log pseudolikelihood = -248.96186  
Iteration 3:   log pseudolikelihood = -246.62426  
Iteration 4:   log pseudolikelihood = -246.48416  
Iteration 5:   log pseudolikelihood = -246.48274  
Iteration 6:   log pseudolikelihood = -246.48274  

Logistic regression                             Number of obs     =      1,808
                                                Wald chi2(10)     =     125.93
                                                Prob > chi2       =     0.0000
Log pseudolikelihood = -246.48274               Pseudo R2         =     0.1855

                              (Std. Err. adjusted for 104 clusters in bankscode)
--------------------------------------------------------------------------------
               |               Robust
poldv_norcfail |      Coef.   Std. Err.      z    P>|z|     [95% Conf. Interval]
---------------+----------------------------------------------------------------
            nt |  -.6321592    .247763    -2.55   0.011    -1.117766   -.1465525
     gdpgrowth |  -.0426849   .0180896    -2.36   0.018    -.0781397     -.00723
               |
      lnincome |
           L1. |  -.2829897   .1500933    -1.89   0.059    -.5771672    .0111877
               |
      urbanpop |
           D1. |     .45425   .3225062     1.41   0.159    -.1778506    1.086351
               |
           elf |  -.1919489   .5943847    -0.32   0.747    -1.356921    .9730237
               |
     lnpopdens |
           L1. |  -.1073891     .10677    -1.01   0.315    -.3166545    .1018764
               |
  pastpolitydv |
           L1. |   -.058837   .0807249    -0.73   0.466     -.217055    .0993809
               |
     polityage |  -.4260981   .0598332    -7.12   0.000     -.543369   -.3088272
polityageknot1 |   .0015107   .0002521     5.99   0.000     .0010166    .0020048
polityageknot2 |  -.0000601   .0000225    -2.67   0.008    -.0001042   -.0000159
         _cons |   1.346661   1.241049     1.09   0.278     -1.08575    3.779072
--------------------------------------------------------------------------------

. drawnorm b1-b11, n(10000) means(e(b)) cov(e(V))  clear 
(obs 10,000)

. gen PROBc=.
(10,000 missing values generated)

. gen PROBclow=.
(10,000 missing values generated)

. gen PROBchigh=.
(10,000 missing values generated)

. gen a =.
(10,000 missing values generated)

. gen nt_axis = (_n-1)/50 + 0 if _n<=118
(9,882 missing values generated)

. /*We want nt to run from 0 to 2.36, ie from 5pctile to 95pctile*/ 
. local a=0

. while `a' <= 2.36 {
  2.         gen x_beta  = b1*`a'+b2*3.48+b3*8.06+b4*0.4+b5*0.42+b6*3.95+b7*1.86+b8*28+b
> 9*7819+b10*33139+b11*1
  3.         gen prob = invlogit(x_beta)
  4.         egen probhat=mean(prob)
  5.       _pctile prob, p(2.5,97.5) 
  6.       scalar problow= r(r1) 
  7.       scalar probhigh= r(r2) 
  8.         quietly replace a = `a' 
  9.         quietly replace PROBc =  probhat  if nt_axis==a
 10.         quietly replace PROBclow =  problow  if nt_axis==a
 11.         quietly replace PROBchigh =  probhigh  if nt_axis==a
 12.         drop x_beta prob* probhat* 
 13.         local a = `a' + .02
 14. }

. label var nt_axis "Non-tax revenue per capita (rescaled)"

. label var PROBc "Regime transition with ruling coalition failure"

. sort nt_axis

. save Mrep3, replace
file Mrep3.dta saved

. 
. 
. merge nt_axis using Mrep1
(note: you are using old merge syntax; see [D] merge for new syntax)
variable nt_axis does not uniquely identify observations in the master data
variable nt_axis does not uniquely identify observations in Mrep1.dta

. sort nt_axis

. drop _merge

. merge nt_axis using Mrep2
(note: you are using old merge syntax; see [D] merge for new syntax)
variable nt_axis does not uniquely identify observations in the master data
variable nt_axis does not uniquely identify observations in Mrep2.dta

. sort nt_axis

. drop _merge

. merge using temp_Morrison_Svolik
(note: you are using old merge syntax; see [D] merge for new syntax)
(label GWF_Regime_Type already defined)
(label GWF_regimefail already defined)
(label Fail_Type already defined)
(label allfails already defined)

. set scheme lean1

. label var nt "Non-tax revenue distribution"

. 
. twoway  (hist nt if nt<2.4 & s==1 & nt>0, yaxis(2)  lcolor(gs12) bin(100) scheme(lean1
> )) /*
> */ (line PROBa nt_axis if nt_axis<=2.4, yaxis(1))  /*
> */ (line PROBb nt_axis if nt_axis<=2.4, yaxis(1))  /*
> */ (line PROBc nt_axis if nt_axis<=2.4, yaxis(1))  /*
> */ , yscale(range (0 0.04)) ylabel(0 (.01) 0.04) xtitle("Non-tax revenue per capita (1
> 000's)", size(3.5)) ytitle("Pr(Failure)", size(3.5)) /*
> */ legend(pos(12) col(2) ring(1) label(1 "Non-tax revenue distribution") label(2 "Repl
> ication estimate") label(3 "Ruling Coalition Failure") label(4 "Ruling Coalition Survi
> val") )

. 
. *graph export "C:\Users\jwright\Documents\My Dropbox\Research\Autocratic Instability\M
> orrisonRep_Svolik.pdf", as(pdf) replace
. 
. 
. 
. 
. 
. 
. ****************************************
. ** BDM and Smith 2010 AJPS, Model 2.2 **
. ****************************************
. 
. use temp_BDM, clear

. 
. sort cowcode year

. count
  27,184

. merge cowcode year using svolik_merge
(note: you are using old merge syntax; see [D] merge for new syntax)
variables cowcode year do not uniquely identify observations in the master data
(note: variable entry was str12 in the using data, but will be int now)
(note: variable exit was str13 in the using data, but will be double now)
(note: variable year was int, now float to accommodate using data's values)

. tab _merge

     _merge |      Freq.     Percent        Cum.
------------+-----------------------------------
          1 |     21,895       80.54       80.54
          2 |          2        0.01       80.55
          3 |      5,289       19.45      100.00
------------+-----------------------------------
      Total |     27,186      100.00

. drop _merge

. 
. *Replication model*
. stset  bdm_t, fail(fail1) id(ID)

                id:  ID
     failure event:  fail1 != 0 & fail1 < .
obs. time interval:  (bdm_t[_n-1], bdm_t]
 exit on or before:  failure

------------------------------------------------------------------------------
      27186  total observations
      11740  ignored because ID missing
         11  event time missing (bdm_t>=.)                      PROBABLE ERROR
------------------------------------------------------------------------------
      15435  observations remaining, representing
       3019  subjects
       2773  failures in single-failure-per-subject data
  12629.555  total analysis time at risk and under observation
                                                at risk from t =         0
                                     earliest observed entry t =         0
                                          last observed exit t =  67.96715

. qui streg W S age Wage threat3 Wthreat NTgdp WNTgdp lGDPpcWB WlGDPpcWB  growthWB Wgrow
> thWB , dis(wei) anc(W ) cluster(ccode)

. estimates store r1

. lincom NTgdp

 ( 1)  [_t]NTgdp = 0

------------------------------------------------------------------------------
          _t |      Coef.   Std. Err.      z    P>|z|     [95% Conf. Interval]
-------------+----------------------------------------------------------------
         (1) |  -.0600965   .0247114    -2.43   0.015    -.1085299   -.0116631
------------------------------------------------------------------------------

. lincom WNTgdp + NTgdp

 ( 1)  [_t]NTgdp + [_t]WNTgdp = 0

------------------------------------------------------------------------------
          _t |      Coef.   Std. Err.      z    P>|z|     [95% Conf. Interval]
-------------+----------------------------------------------------------------
         (1) |   .0206928   .0166032     1.25   0.213    -.0118489    .0532344
------------------------------------------------------------------------------

. 
. 
. *DV*
. /* leadership failure + ruling coalition failure */
. gen fail_rcfail = .
(27,186 missing values generated)

. replace fail_rcfail = fail2 if spell_id==.
(10,511 real changes made)

. replace fail_rcfail = 0 if fail1==0 & spell_id~=.
(4,347 real changes made)

. replace fail_rcfail = 1 if fail1==1 & svolik_RC==1 & spell_id~=.
(261 real changes made)

. replace fail_rcfail = 0 if fail1==1 & svolik_RC==0 & spell_id~=.
(300 real changes made)

. /* leadership failure + no ruling coalition failure */
. gen fail_norcfail = .  
(27,186 missing values generated)

. replace fail_norcfail = fail3 if spell_id==.
(10,511 real changes made)

. replace fail_norcfail = 0 if fail1==0 & spell_id~=.
(4,347 real changes made)

. replace fail_norcfail = 1 if fail1==1 & svolik_RC==0 & spell_id~=.
(300 real changes made)

. replace fail_norcfail = 0 if fail1==1 & svolik_RC==1 & spell_id~=.
(261 real changes made)

. 
. 
. sum bdm_d _d fail* if e(sample)

    Variable |        Obs        Mean    Std. Dev.       Min        Max
-------------+---------------------------------------------------------
       bdm_d |      2,105    .1591449    .3658981          0          1
          _d |      2,105    .1591449    .3658981          0          1
        fail |      2,105    .1686461     .374528          0          1
       fail1 |      2,105    .1591449    .3658981          0          1
       fail2 |      2,105    .0213777    .1446742          0          1
-------------+---------------------------------------------------------
       fail3 |      2,105    .1377672    .3447374          0          1
 fail_rcfail |      2,103    .0199715    .1399354          0          1
fail_norcf~l |      2,103    .1383738     .345374          0          1

. tab fail1 fail_rcfail if e(sample)

           |      fail_rcfail
     fail1 |         0          1 |     Total
-----------+----------------------+----------
         0 |     1,770          0 |     1,770 
         1 |       291         42 |       333 
-----------+----------------------+----------
     Total |     2,061         42 |     2,103 


. tab fail1 fail_norcfail if e(sample)

           |     fail_norcfail
     fail1 |         0          1 |     Total
-----------+----------------------+----------
         0 |     1,770          0 |     1,770 
         1 |        42        291 |       333 
-----------+----------------------+----------
     Total |     1,812        291 |     2,103 


. 
. 
. *Only coalition failures*
. stset  bdm_t, fail(fail_rcfail) id(ID)

                id:  ID
     failure event:  fail_rcfail != 0 & fail_rcfail < .
obs. time interval:  (bdm_t[_n-1], bdm_t]
 exit on or before:  failure

------------------------------------------------------------------------------
      27186  total observations
      11740  ignored because ID missing
         11  event time missing (bdm_t>=.)                      PROBABLE ERROR
------------------------------------------------------------------------------
      15435  observations remaining, representing
       3019  subjects
        378  failures in single-failure-per-subject data
  12629.555  total analysis time at risk and under observation
                                                at risk from t =         0
                                     earliest observed entry t =         0
                                          last observed exit t =  67.96715

. tab _d fail_rcfail if e(sample)

      1 if |
failure; 0 |
        if |      fail_rcfail
  censored |         0          1 |     Total
-----------+----------------------+----------
         0 |     2,061          0 |     2,061 
         1 |         0         42 |        42 
-----------+----------------------+----------
     Total |     2,061         42 |     2,103 


. qui streg W S age Wage threat3 Wthreat NTgdp WNTgdp lGDPpcWB WlGDPpcWB  growthWB Wgrow
> thWB , dis(wei) anc(W ) cluster(cowcode)

. estimates store r2

. lincom NTgdp

 ( 1)  [_t]NTgdp = 0

------------------------------------------------------------------------------
          _t |      Coef.   Std. Err.      z    P>|z|     [95% Conf. Interval]
-------------+----------------------------------------------------------------
         (1) |  -.0028527   .0374388    -0.08   0.939    -.0762314     .070526
------------------------------------------------------------------------------

. lincom WNTgdp  + NTgdp

 ( 1)  [_t]NTgdp + [_t]WNTgdp = 0

------------------------------------------------------------------------------
          _t |      Coef.   Std. Err.      z    P>|z|     [95% Conf. Interval]
-------------+----------------------------------------------------------------
         (1) |  -.0034366   .0645363    -0.05   0.958    -.1299253    .1230521
------------------------------------------------------------------------------

. 
. *Only non-coalition failures*
. stset  bdm_t, fail(fail_norcfail) id(ID)

                id:  ID
     failure event:  fail_norcfail != 0 & fail_norcfail < .
obs. time interval:  (bdm_t[_n-1], bdm_t]
 exit on or before:  failure

------------------------------------------------------------------------------
      27186  total observations
      11740  ignored because ID missing
         11  event time missing (bdm_t>=.)                      PROBABLE ERROR
------------------------------------------------------------------------------
      15435  observations remaining, representing
       3019  subjects
       2379  failures in single-failure-per-subject data
  12629.555  total analysis time at risk and under observation
                                                at risk from t =         0
                                     earliest observed entry t =         0
                                          last observed exit t =  67.96715

. tab _d fail_norcfail if e(sample)

      1 if |
failure; 0 |
        if |     fail_norcfail
  censored |         0          1 |     Total
-----------+----------------------+----------
         0 |     1,812          0 |     1,812 
         1 |         0        291 |       291 
-----------+----------------------+----------
     Total |     1,812        291 |     2,103 


. qui streg W S age Wage threat3 Wthreat NTgdp WNTgdp lGDPpcWB WlGDPpcWB  growthWB Wgrow
> thWB , dis(wei) anc(W ) cluster(cowcode)

. estimates store r3

. lincom NTgdp

 ( 1)  [_t]NTgdp = 0

------------------------------------------------------------------------------
          _t |      Coef.   Std. Err.      z    P>|z|     [95% Conf. Interval]
-------------+----------------------------------------------------------------
         (1) |  -.0782843    .027004    -2.90   0.004    -.1312112   -.0253575
------------------------------------------------------------------------------

. lincom WNTgdp + NTgdp

 ( 1)  [_t]NTgdp + [_t]WNTgdp = 0

------------------------------------------------------------------------------
          _t |      Coef.   Std. Err.      z    P>|z|     [95% Conf. Interval]
-------------+----------------------------------------------------------------
         (1) |   .0249977   .0217439     1.15   0.250    -.0176194    .0676149
------------------------------------------------------------------------------

. 
. estout  r1 r2 r3 using TableG2.tex, cells(b(star  fmt(%9.3f)) se(par fmt(%9.2f))) stat
> s(ll r2 N) style(tex) replace label starlevels(* 0.10 ** 0.05)
(output written to TableG2.tex)

. 
. 
. ***Hazards***
. 
.         stset  bdm_t, fail(fail1) id(ID)

                id:  ID
     failure event:  fail1 != 0 & fail1 < .
obs. time interval:  (bdm_t[_n-1], bdm_t]
 exit on or before:  failure

------------------------------------------------------------------------------
      27186  total observations
      11740  ignored because ID missing
         11  event time missing (bdm_t>=.)                      PROBABLE ERROR
------------------------------------------------------------------------------
      15435  observations remaining, representing
       3019  subjects
       2773  failures in single-failure-per-subject data
  12629.555  total analysis time at risk and under observation
                                                at risk from t =         0
                                     earliest observed entry t =         0
                                          last observed exit t =  67.96715

.         qui streg W S age Wage threat3 Wthreat NTgdp WNTgdp lGDPpcWB WlGDPpcWB  growth
> WB WgrowthWB , dis(wei) cluster(ccode)

.         lincom NTgdp

 ( 1)  [_t]NTgdp = 0

------------------------------------------------------------------------------
          _t |      Coef.   Std. Err.      z    P>|z|     [95% Conf. Interval]
-------------+----------------------------------------------------------------
         (1) |  -.0739612   .0251117    -2.95   0.003    -.1231792   -.0247433
------------------------------------------------------------------------------

.         lincom WNTgdp + NTgdp

 ( 1)  [_t]NTgdp + [_t]WNTgdp = 0

------------------------------------------------------------------------------
          _t |      Coef.   Std. Err.      z    P>|z|     [95% Conf. Interval]
-------------+----------------------------------------------------------------
         (1) |   .0203457    .016014     1.27   0.204    -.0110413    .0517326
------------------------------------------------------------------------------

.         stcurve, hazard at1(NTgdp=3, WNTgdp=0, W=0) at2(NTgdp=13, WNTgdp=0, W=0) /*
>         */  legend(pos(12) col(2) ring(1) label(1 "Non-tax= 3%") label(2 "Non-tax= 13%
> "))/*
>         */ yscale(range (0 0.1)) xscale(range (0 12)) xlabel(0 (2) 12)  range(0 12) 

.         *graph export "C:\Users\jwright\Documents\My Dropbox\Research\Autocratic Insta
> bility\BDMSmithRep_Svolik1.pdf", as(pdf)                            replace
. 
.         stset  bdm_t, fail(fail_rcfail) id(ID)

                id:  ID
     failure event:  fail_rcfail != 0 & fail_rcfail < .
obs. time interval:  (bdm_t[_n-1], bdm_t]
 exit on or before:  failure

------------------------------------------------------------------------------
      27186  total observations
      11740  ignored because ID missing
         11  event time missing (bdm_t>=.)                      PROBABLE ERROR
------------------------------------------------------------------------------
      15435  observations remaining, representing
       3019  subjects
        378  failures in single-failure-per-subject data
  12629.555  total analysis time at risk and under observation
                                                at risk from t =         0
                                     earliest observed entry t =         0
                                          last observed exit t =  67.96715

.         qui streg W S age Wage threat3 Wthreat NTgdp WNTgdp lGDPpcWB WlGDPpcWB  growth
> WB WgrowthWB , dis(wei) cluster(ccode)

.         lincom NTgdp

 ( 1)  [_t]NTgdp = 0

------------------------------------------------------------------------------
          _t |      Coef.   Std. Err.      z    P>|z|     [95% Conf. Interval]
-------------+----------------------------------------------------------------
         (1) |  -.0038794   .0455553    -0.09   0.932    -.0931661    .0854074
------------------------------------------------------------------------------

.         lincom WNTgdp + NTgdp

 ( 1)  [_t]NTgdp + [_t]WNTgdp = 0

------------------------------------------------------------------------------
          _t |      Coef.   Std. Err.      z    P>|z|     [95% Conf. Interval]
-------------+----------------------------------------------------------------
         (1) |  -.0030984    .068116    -0.05   0.964    -.1366033    .1304064
------------------------------------------------------------------------------

.         stcurve, hazard at1(NTgdp=3, WNTgdp=0, W=0) at2(NTgdp=13, WNTgdp=0, W=0) /*
>         */  legend(pos(12) col(2) ring(1) label(1 "Non-tax= 3%") label(2 "Non-tax= 13%
> "))/*
>         */ xscale(range (0 12)) xlabel(0 (2) 12)  range(0 12) 

.         *graph export "C:\Users\jwright\Documents\My Dropbox\Research\Autocratic Insta
> bility\BDMSmithRep_Svolik2.pdf", as(pdf)                            replace
. 
.         stset  bdm_t, fail(fail_norcfail) id(ID)

                id:  ID
     failure event:  fail_norcfail != 0 & fail_norcfail < .
obs. time interval:  (bdm_t[_n-1], bdm_t]
 exit on or before:  failure

------------------------------------------------------------------------------
      27186  total observations
      11740  ignored because ID missing
         11  event time missing (bdm_t>=.)                      PROBABLE ERROR
------------------------------------------------------------------------------
      15435  observations remaining, representing
       3019  subjects
       2379  failures in single-failure-per-subject data
  12629.555  total analysis time at risk and under observation
                                                at risk from t =         0
                                     earliest observed entry t =         0
                                          last observed exit t =  67.96715

.         qui streg W S age Wage threat3 Wthreat NTgdp WNTgdp lGDPpcWB WlGDPpcWB  growth
> WB WgrowthWB , dis(wei) cluster(ccode)

.         lincom NTgdp

 ( 1)  [_t]NTgdp = 0

------------------------------------------------------------------------------
          _t |      Coef.   Std. Err.      z    P>|z|     [95% Conf. Interval]
-------------+----------------------------------------------------------------
         (1) |  -.0947205   .0255402    -3.71   0.000    -.1447784   -.0446626
------------------------------------------------------------------------------

.         lincom WNTgdp + NTgdp

 ( 1)  [_t]NTgdp + [_t]WNTgdp = 0

------------------------------------------------------------------------------
          _t |      Coef.   Std. Err.      z    P>|z|     [95% Conf. Interval]
-------------+----------------------------------------------------------------
         (1) |   .0242432   .0162368     1.49   0.135    -.0075803    .0560667
------------------------------------------------------------------------------

.         stcurve, hazard at1(NTgdp=3, WNTgdp=0, W=0) at2(NTgdp=13, WNTgdp=0, W=0) /*
>         */  legend(pos(12) col(2) ring(1) label(1 "Non-tax= 3%") label(2 "Non-tax= 13%
> "))/*
>         */ xscale(range (0 12)) xlabel(0 (2) 12)  range(0 12) 

.         *graph export "C:\Users\jwright\Documents\My Dropbox\Research\Autocratic Insta
> bility\BDMSmithRep_Svolik3.pdf", as(pdf)                            replace
. 
. 
.         
.         
.         
. 
. ***************************************
. **********Ahmed Replication************
. ***************************************
. use temp_Ahmed, clear

. count
  10,540

. merge cowcode year using svolik_merge
(note: you are using old merge syntax; see [D] merge for new syntax)

. tab _merge

     _merge |      Freq.     Percent        Cum.
------------+-----------------------------------
          1 |      5,922       55.73       55.73
          2 |         87        0.82       56.54
          3 |      4,618       43.46      100.00
------------+-----------------------------------
      Total |     10,627      100.00

. drop if _merge==2
(87 observations deleted)

. drop _merge

. tsset cowcode year
       panel variable:  cowcode (unbalanced)
        time variable:  year, 1946 to 2010, but with a gap
                delta:  1 unit

. 
. 
. *DV* 
. /* government turnover + ruling coalition failure */
. gen turnover_rcfail = .
(10,540 missing values generated)

. replace turnover_rcfail = turnover2 if spell_id==.
(4,131 real changes made)

. replace turnover_rcfail = 0 if turnover==0 & spell_id~=.
(2,227 real changes made)

. replace turnover_rcfail = 1 if turnover==1 & svolik_RC==1 & spell_id~=.
(68 real changes made)

. replace turnover_rcfail = 0 if turnover==1 & svolik_RC==0 & spell_id~=.
(127 real changes made)

. /* government turnover+ no ruling coalition failure */
. gen turnover_norcfail = .  
(10,540 missing values generated)

. replace turnover_norcfail = turnover1 if spell_id==.
(2,384 real changes made)

. replace turnover_norcfail = 0 if turnover==0 & spell_id~=.
(2,227 real changes made)

. replace turnover_norcfail = 1 if turnover==1 & svolik_RC==0 & spell_id~=.
(127 real changes made)

. replace turnover_norcfail = 0 if turnover==1 & svolik_RC==1 & spell_id~=.
(68 real changes made)

. 
. 
. save temp_Ahmed_Svolik, replace
file temp_Ahmed_Svolik.dta saved

. 
. 
. **********************************
. ** Ahmed 2012, Table 3 column 2 **
. **********************************
. *Replication
.    qui probit turnover aid_remit beta beta_AR finittrm lngdpcap ggdpcap lnpop war ldis
>  hdis time_dum* codummy* ydummy* if sumsamp==1, cluster(govtcode)

.         *sum beta if e(sample), detail
.         lroc, nograph

Probit model for turnover

number of observations =     1639
area under ROC curve   =   0.8312

.         tab turnover if e(sample)

    Failure |      Freq.     Percent        Cum.
------------+-----------------------------------
          0 |      1,348       82.25       82.25
          1 |        291       17.75      100.00
------------+-----------------------------------
      Total |      1,639      100.00

.         lincom aid_remit + beta_AR*.048   /*5 pctile*/

 ( 1)  [turnover]aid_remit + .048*[turnover]beta_AR = 0

------------------------------------------------------------------------------
    turnover |      Coef.   Std. Err.      z    P>|z|     [95% Conf. Interval]
-------------+----------------------------------------------------------------
         (1) |   .0088917   .0125021     0.71   0.477    -.0156119    .0333954
------------------------------------------------------------------------------

.         lincom aid_remit + beta_AR*.5   /*95 pctile*/

 ( 1)  [turnover]aid_remit + .5*[turnover]beta_AR = 0

------------------------------------------------------------------------------
    turnover |      Coef.   Std. Err.      z    P>|z|     [95% Conf. Interval]
-------------+----------------------------------------------------------------
         (1) |  -.0659512   .0364271    -1.81   0.070    -.1373469    .0054446
------------------------------------------------------------------------------

.         est store a1

. 
. *DPI fail and Svolik RC fail
.   qui probit turnover_rcfail aid_remit beta beta_AR finittrm lngdpcap ggdpcap lnpop wa
> r ldis hdis time_dum* codummy* ydummy* if sumsamp==1, cluster(govtcode)

.         *sum beta if e(sample), detail
.         lroc, nograph

Probit model for turnover_rcfail

number of observations =      576
area under ROC curve   =   0.9083

.         tab turnover_rcfail if e(sample)

turnover_rc |
       fail |      Freq.     Percent        Cum.
------------+-----------------------------------
          0 |        521       90.45       90.45
          1 |         55        9.55      100.00
------------+-----------------------------------
      Total |        576      100.00

.         lincom aid_remit + beta_AR*.053   /*5 pctile*/

 ( 1)  [turnover_rcfail]aid_remit + .053*[turnover_rcfail]beta_AR = 0

------------------------------------------------------------------------------
turnover_r~l |      Coef.   Std. Err.      z    P>|z|     [95% Conf. Interval]
-------------+----------------------------------------------------------------
         (1) |   .0696959   .0205917     3.38   0.001      .029337    .1100549
------------------------------------------------------------------------------

.         lincom aid_remit + beta_AR*.5   /*95 pctile*/

 ( 1)  [turnover_rcfail]aid_remit + .5*[turnover_rcfail]beta_AR = 0

------------------------------------------------------------------------------
turnover_r~l |      Coef.   Std. Err.      z    P>|z|     [95% Conf. Interval]
-------------+----------------------------------------------------------------
         (1) |  -.0403962   .0700401    -0.58   0.564    -.1776722    .0968798
------------------------------------------------------------------------------

.         est store a2

. 
. *DPI fail but No Svolik RC fail
.   qui probit turnover_norcfail aid_remit beta beta_AR finittrm lngdpcap ggdpcap lnpop 
> war ldis hdis time_dum* codummy* ydummy* if sumsamp==1, cluster(govtcode)

.         *sum beta if e(sample), detail
.         lroc, nograph

Probit model for turnover_norcfail

number of observations =     1446
area under ROC curve   =   0.8210

.         tab turnover_norcfail if e(sample)

turnover_no |
     rcfail |      Freq.     Percent        Cum.
------------+-----------------------------------
          0 |      1,220       84.37       84.37
          1 |        226       15.63      100.00
------------+-----------------------------------
      Total |      1,446      100.00

.         lincom aid_remit + beta_AR*.048   /*5 pctile*/

 ( 1)  [turnover_norcfail]aid_remit + .048*[turnover_norcfail]beta_AR = 0

------------------------------------------------------------------------------
turnover_n~l |      Coef.   Std. Err.      z    P>|z|     [95% Conf. Interval]
-------------+----------------------------------------------------------------
         (1) |  -.0199588   .0141433    -1.41   0.158    -.0476792    .0077615
------------------------------------------------------------------------------

.         lincom aid_remit + beta_AR*.5   /*95 pctile*/

 ( 1)  [turnover_norcfail]aid_remit + .5*[turnover_norcfail]beta_AR = 0

------------------------------------------------------------------------------
turnover_n~l |      Coef.   Std. Err.      z    P>|z|     [95% Conf. Interval]
-------------+----------------------------------------------------------------
         (1) |   -.081037   .0446783    -1.81   0.070    -.1686048    .0065308
------------------------------------------------------------------------------

.         est store a3

. 
. *Replication w. correctly lagged beta
.   qui probit turnover aid_remit beta3 beta3_AR finittrm lngdpcap ggdpcap lnpop war ldi
> s hdis time_dum* codummy* ydummy* if sumsamp==1, cluster(govtcode)

.         *sum beta3 if e(sample), detail
.         lroc, nograph

Probit model for turnover

number of observations =     1638
area under ROC curve   =   0.8261

.         tab turnover if e(sample)

    Failure |      Freq.     Percent        Cum.
------------+-----------------------------------
          0 |      1,348       82.30       82.30
          1 |        290       17.70      100.00
------------+-----------------------------------
      Total |      1,638      100.00

.         lincom aid_remit + beta3_AR*.048   /*5 pctile*/

 ( 1)  [turnover]aid_remit + .048*[turnover]beta3_AR = 0

------------------------------------------------------------------------------
    turnover |      Coef.   Std. Err.      z    P>|z|     [95% Conf. Interval]
-------------+----------------------------------------------------------------
         (1) |   .0026526   .0139091     0.19   0.849    -.0246087    .0299138
------------------------------------------------------------------------------

.         lincom aid_remit + beta3_AR*.5   /*95 pctile*/

 ( 1)  [turnover]aid_remit + .5*[turnover]beta3_AR = 0

------------------------------------------------------------------------------
    turnover |      Coef.   Std. Err.      z    P>|z|     [95% Conf. Interval]
-------------+----------------------------------------------------------------
         (1) |  -.0172191   .0270776    -0.64   0.525    -.0702902    .0358521
------------------------------------------------------------------------------

.         est store a4

. 
. *DPI fail and Svolik RC fail w. correctly lagged beta
.   qui probit turnover_rcfail aid_remit beta3 beta3_AR finittrm lngdpcap ggdpcap lnpop 
> war ldis hdis time_dum* codummy* ydummy* if sumsamp==1, cluster(govtcode)

.         *sum beta3 if e(sample), detail
.         lroc, nograph

Probit model for turnover_rcfail

number of observations =      551
area under ROC curve   =   0.9020

.         tab turnover_rcfail if e(sample)

turnover_rc |
       fail |      Freq.     Percent        Cum.
------------+-----------------------------------
          0 |        497       90.20       90.20
          1 |         54        9.80      100.00
------------+-----------------------------------
      Total |        551      100.00

.         lincom aid_remit + beta3_AR*.053   /*5 pctile*/

 ( 1)  [turnover_rcfail]aid_remit + .053*[turnover_rcfail]beta3_AR = 0

------------------------------------------------------------------------------
turnover_r~l |      Coef.   Std. Err.      z    P>|z|     [95% Conf. Interval]
-------------+----------------------------------------------------------------
         (1) |   .0763638     .02575     2.97   0.003     .0258947    .1268329
------------------------------------------------------------------------------

.         lincom aid_remit + beta3_AR*.5   /*95 pctile*/

 ( 1)  [turnover_rcfail]aid_remit + .5*[turnover_rcfail]beta3_AR = 0

------------------------------------------------------------------------------
turnover_r~l |      Coef.   Std. Err.      z    P>|z|     [95% Conf. Interval]
-------------+----------------------------------------------------------------
         (1) |  -.0032006   .0528955    -0.06   0.952     -.106874    .1004727
------------------------------------------------------------------------------

.         est store a5

.  
. *DPI fail but No Svolik RC fail w. correctly lagged beta
.   qui probit turnover_norcfail aid_remit beta3 beta3_AR finittrm lngdpcap ggdpcap lnpo
> p war ldis hdis time_dum* codummy* ydummy* if sumsamp==1, cluster(govtcode)

.         *sum beta3 if e(sample), detail
.         lroc, nograph

Probit model for turnover_norcfail

number of observations =     1445
area under ROC curve   =   0.8208

.         tab turnover_norcfail if e(sample)

turnover_no |
     rcfail |      Freq.     Percent        Cum.
------------+-----------------------------------
          0 |      1,219       84.36       84.36
          1 |        226       15.64      100.00
------------+-----------------------------------
      Total |      1,445      100.00

.         lincom aid_remit + beta3_AR*.048   /*5 pctile*/

 ( 1)  [turnover_norcfail]aid_remit + .048*[turnover_norcfail]beta3_AR = 0

------------------------------------------------------------------------------
turnover_n~l |      Coef.   Std. Err.      z    P>|z|     [95% Conf. Interval]
-------------+----------------------------------------------------------------
         (1) |  -.0199925   .0159638    -1.25   0.210    -.0512809    .0112959
------------------------------------------------------------------------------

.         lincom aid_remit + beta3_AR*.5   /*95 pctile*/

 ( 1)  [turnover_norcfail]aid_remit + .5*[turnover_norcfail]beta3_AR = 0

------------------------------------------------------------------------------
turnover_n~l |      Coef.   Std. Err.      z    P>|z|     [95% Conf. Interval]
-------------+----------------------------------------------------------------
         (1) |  -.0905563   .0432231    -2.10   0.036     -.175272   -.0058406
------------------------------------------------------------------------------

.         est store a6

.  
. set matsize 2000

. *set emptycells drop
. estout a1 a2 a3 a4 a5 a6 using TableG3.tex, cells(b(star  fmt(%9.3f)) se(par fmt(%9.2f
> ))) stats(ll r2 N) drop(time_dum* codummy* ydummy*) style(tex) replace label starlevel
> s(* 0.10 ** 0.05)
(output written to TableG3.tex)

. set matsize 500

. 
. /*
>  *******************
>  *** Simulations ***   
>  *******************
>  
>  * (1) *
>  use temp_Ahmed_Svolik, clear
>  set more off
>  probit turnover aid_remit beta beta_AR finittrm lngdpcap ggdpcap lnpop war ldis hdis 
> time_dum* codummy* ydummy* if sumsamp==1, cluster(govtcode)
>  matrix m1 = e(b)
>  scalar s1 = colsof(m1)
>  scalar list s1 /*343*/
>  set seed 9879789
>  drawnorm b1-b343, n(10000) means(e(b)) cov(e(V))  clear 
>  gen PROB1dem=.
>  gen PROB1demlow=.
>  gen PROB1demhigh=.
>  gen PROB1aut=.
>  gen PROB1autlow=.
>  gen PROB1authigh=.
> 
>  gen a =.
>  gen ar_axis = (_n-1)/5 + 0.5 if _n<=132
>  /*We want nt to run from 0.5 to 26.5, ie from 5pctile to 95pctile*/ 
>  local a=0.5
>  while `a' <= 26.5 {
>         gen x_betaDem  = b1*`a'+b2*.05+b3*.05*`a'+b4*1+b5*6.86+b6*1.34+b7*16.06+b8*0+b
> 9*0+b10*0+b343*1
>         gen x_betaAut  = b1*`a'+b2*.5+b3*.5*`a'  +b4*1+b5*6.86+b6*1.34+b7*16.06+b8*0+b
> 9*0+b10*0+b343*1
>         gen probD = normal(x_betaDem)
>         gen probA = normal(x_betaAut) 
>         egen probDhat = mean(probD)
>       _pctile probD, p(2.5,97.5) 
>       scalar probDlow= r(r1) 
>       scalar probDhigh= r(r2) 
>         egen probAhat = mean(probA)
>       _pctile probA, p(2.5,97.5) 
>       scalar probAlow= r(r1) 
>       scalar probAhigh= r(r2) 
>         quietly replace a = `a' 
>         quietly replace PROB1dem =  probDhat  if ar_axis==a
>         quietly replace PROB1demlow =  probDlow  if ar_axis==a
>         quietly replace PROB1demhigh =  probDhigh  if ar_axis==a
>         quietly replace PROB1aut =  probAhat  if ar_axis==a
>         quietly replace PROB1autlow =  probAlow  if ar_axis==a
>         quietly replace PROB1authigh =  probAhigh  if ar_axis==a
>         drop x_beta* prob*  
>         local a = `a' + .2
>  }
>  label var ar_axis "Aid + Remit"
>  label var PROB1dem "All failures"
>  label var PROB1aut "All failures"
>  sort ar_axis
>  twoway (line PROB1dem ar_axis)  (line PROB1aut ar_axis) 
>  saveold Arep1, replace
>  
>   * (2) *
>   use temp_Ahmed_Svolik, clear
>   set more off
>   probit turnover_rcfail aid_remit beta beta_AR finittrm lngdpcap ggdpcap lnpop war ld
> is hdis   time_dum*  codummy* ydummy* if sumsamp==1, cluster(govtcode)
>    matrix m1 = e(b)
>   scalar s1 = colsof(m1)
>   scalar list s1 /*343*/
>   drawnorm b1-b343, n(10000) means(e(b)) cov(e(V))  clear 
>  gen PROB2dem=.
>  gen PROB2demlow=.
>  gen PROB2demhigh=.
>  gen PROB2aut=.
>  gen PROB2autlow=.
>  gen PROB2authigh=.
>   gen a =.
>   gen ar_axis = (_n-1)/5 + 0.5 if _n<=132
>   /*We want nt to run from 0.5 to 26.5, ie from 5pctile to 95pctile*/ 
>   local a=0.5
>   while `a' <= 26.5 {
>         gen x_betaDem  = b1*`a'+b2*.05+b3*.05*`a'+b4*1+b5*6.86+b6*1.34+b7*16.06+b8*0+b
> 9*0+b10*0+b343*1
>         gen x_betaAut  = b1*`a'+b2*.5+b3*.5*`a'  +b4*1+b5*6.86+b6*1.34+b7*16.06+b8*0+b
> 9*0+b10*0+b343*1
>         gen probD = normal(x_betaDem)
>         gen probA = normal(x_betaAut) 
>         egen probDhat = mean(probD)
>       _pctile probD, p(2.5,97.5) 
>       scalar probDlow= r(r1) 
>       scalar probDhigh= r(r2) 
>         egen probAhat = mean(probA)
>       _pctile probA, p(2.5,97.5) 
>       scalar probAlow= r(r1) 
>       scalar probAhigh= r(r2) 
>         quietly replace a = `a' 
>         quietly replace PROB2dem =  probDhat  if ar_axis==a
>         quietly replace PROB2demlow =  probDlow  if ar_axis==a
>         quietly replace PROB2demhigh =  probDhigh  if ar_axis==a
>         quietly replace PROB2aut =  probAhat  if ar_axis==a
>         quietly replace PROB2autlow =  probAlow  if ar_axis==a
>         quietly replace PROB2authigh =  probAhigh  if ar_axis==a
>         drop x_beta* prob*  
>         local a = `a' + .2
>   }
>   label var ar_axis "Aid + Remit"
>   label var PROB2dem "Coalition failure"
>   label var PROB2aut "Coalition failure"
>   sort ar_axis
>   twoway (line PROB2dem ar_axis)  (line PROB2aut ar_axis) 
>  saveold Arep2, replace
>  
>   * (3) *
>   use temp_Ahmed_Svolik, clear
>   set more off
>   probit turnover_norcfail aid_remit beta beta_AR finittrm lngdpcap ggdpcap lnpop war 
> ldis hdis time_dum*  codummy* ydummy* if sumsamp==1, cluster(govtcode)
>     matrix m1 = e(b)
>   scalar s1 = colsof(m1)
>   scalar list s1 /*343*/
>   drawnorm b1-b343, n(10000) means(e(b)) cov(e(V))  clear 
>   gen PROB3dem=.
>   gen PROB3demlow=.
>   gen PROB3demhigh=.
>   gen PROB3aut=.
>   gen PROB3autlow=.
>   gen PROB3authigh=.
>   gen a =.
>   gen ar_axis = (_n-1)/5 + 0.5 if _n<=132
>   /*We want nt to run from 0.5 to 26.5, ie from 5pctile to 95pctile*/ 
>   local a=0.5
>   while `a' <= 26.5 {
>         gen x_betaDem  = b1*`a'+b2*.05+b3*.05*`a'+b4*1+b5*6.86+b6*1.34+b7*16.06+b8*0+b
> 9*0+b10*0+b343*1
>         gen x_betaAut  = b1*`a'+b2*.5+b3*.5*`a'  +b4*1+b5*6.86+b6*1.34+b7*16.06+b8*0+b
> 9*0+b10*0+b343*1
>         gen probD = normal(x_betaDem)
>         gen probA = normal(x_betaAut) 
>         egen probDhat = mean(probD)
>       _pctile probD, p(2.5,97.5) 
>       scalar probDlow= r(r1) 
>       scalar probDhigh= r(r2) 
>         egen probAhat = mean(probA)
>       _pctile probA, p(2.5,97.5) 
>       scalar probAlow= r(r1) 
>       scalar probAhigh= r(r2) 
>         quietly replace a = `a' 
>         quietly replace PROB3dem =  probDhat  if ar_axis==a
>         quietly replace PROB3demlow =  probDlow  if ar_axis==a
>         quietly replace PROB3demhigh =  probDhigh  if ar_axis==a
>         quietly replace PROB3aut =  probAhat  if ar_axis==a
>         quietly replace PROB3autlow =  probAlow  if ar_axis==a
>         quietly replace PROB3authigh =  probAhigh  if ar_axis==a
>         drop x_beta* prob*  
>         local a = `a' + .2
>   }
>   label var ar_axis "Aid + Remit"
>   label var PROB3dem "Coalition survival"
>   label var PROB3aut "Coalition survival"
>   sort ar_axis
>   twoway (line PROB3dem ar_axis)  (line PROB3aut ar_axis) 
>   saveold Arep3, replace
>  
>  
>   * (4) *
>  use temp_Ahmed_Svolik, clear
>  set more off
>  probit turnover aid_remit beta3 beta3_AR finittrm lngdpcap ggdpcap lnpop war ldis hdi
> s time_dum*  codummy* ydummy*  if sumsamp==1, cluster(govtcode)
>  drawnorm b1-b343, n(10000) means(e(b)) cov(e(V))  clear 
>  gen PROB4dem=.
>  gen PROB4demlow=.
>  gen PROB4demhigh=.
>  gen PROB4aut=.
>  gen PROB4autlow=.
>  gen PROB4authigh=.
>  gen a =.
>  gen ar_axis = (_n-1)/5 + 0.5 if _n<=132
>  /*We want nt to run from 0.5 to 26.5, ie from 5pctile to 95pctile*/ 
>  local a=0.5
>  while `a' <= 26.5 {
>         gen x_betaDem  = b1*`a'+b2*.05+b3*.05*`a'+b4*1+b5*6.86+b6*1.34+b7*16.06+b8*0+b
> 9*0+b10*0+b343*1
>         gen x_betaAut  = b1*`a'+b2*.5+b3*.5*`a'  +b4*1+b5*6.86+b6*1.34+b7*16.06+b8*0+b
> 9*0+b10*0+b343*1
>         gen probD = normal(x_betaDem)
>         gen probA = normal(x_betaAut) 
>         egen probDhat = mean(probD)
>       _pctile probD, p(2.5,97.5) 
>       scalar probDlow= r(r1) 
>       scalar probDhigh= r(r2) 
>         egen probAhat = mean(probA)
>       _pctile probA, p(2.5,97.5) 
>       scalar probAlow= r(r1) 
>       scalar probAhigh= r(r2) 
>         quietly replace a = `a' 
>         quietly replace PROB4dem =  probDhat  if ar_axis==a
>         quietly replace PROB4demlow =  probDlow  if ar_axis==a
>         quietly replace PROB4demhigh =  probDhigh  if ar_axis==a
>         quietly replace PROB4aut =  probAhat  if ar_axis==a
>         quietly replace PROB4autlow =  probAlow  if ar_axis==a
>         quietly replace PROB4authigh =  probAhigh  if ar_axis==a
>         drop x_beta* prob*  
>         local a = `a' + .2
>  }
>  label var ar_axis "Aid + Remit"
>  label var PROB4dem "All failures"
>  label var PROB4aut "All failures"
>  sort ar_axis
>  twoway (line PROB4dem ar_axis)  (line PROB4aut ar_axis) 
>  saveold Arep4, replace
>  
>  * (5) *
>  use temp_Ahmed_Svolik, clear
>  set more off
>  probit turnover_rcfail aid_remit beta3 beta3_AR finittrm lngdpcap ggdpcap lnpop war l
> dis hdis time_dum*  codummy* ydummy* if sumsamp==1, cluster(govtcode)
>    matrix m1 = e(b)
>  scalar s1 = colsof(m1)
>  scalar list s1 /*343*/
>  drawnorm b1-b343, n(10000) means(e(b)) cov(e(V))  clear 
>  gen PROB5dem=.
>  gen PROB5demlow=.
>  gen PROB5demhigh=.
>  gen PROB5aut=.
>  gen PROB5autlow=.
>  gen PROB5authigh=.
>  gen a =.
>  gen ar_axis = (_n-1)/5 + 0.5 if _n<=132
>  /*We want nt to run from 0.5 to 26.5, ie from 5pctile to 95pctile*/ 
>  local a=0.5
>  while `a' <= 26.5 {
>         gen x_betaDem  = b1*`a'+b2*.05+b3*.05*`a'+b4*1+b5*6.86+b6*1.34+b7*16.06+b8*0+b
> 9*0+b10*0+b343*1
>         gen x_betaAut  = b1*`a'+b2*.5+b3*.5*`a'  +b4*1+b5*6.86+b6*1.34+b7*16.06+b8*0+b
> 9*0+b10*0+b343*1
>         gen probD = normal(x_betaDem)
>         gen probA = normal(x_betaAut) 
>         egen probDhat = mean(probD)
>       _pctile probD, p(2.5,97.5) 
>       scalar probDlow= r(r1) 
>       scalar probDhigh= r(r2) 
>         egen probAhat = mean(probA)
>       _pctile probA, p(2.5,97.5) 
>       scalar probAlow= r(r1) 
>       scalar probAhigh= r(r2) 
>         quietly replace a = `a' 
>         quietly replace PROB5dem =  probDhat  if ar_axis==a
>         quietly replace PROB5demlow =  probDlow  if ar_axis==a
>         quietly replace PROB5demhigh =  probDhigh  if ar_axis==a
>         quietly replace PROB5aut =  probAhat  if ar_axis==a
>         quietly replace PROB5autlow =  probAlow  if ar_axis==a
>         quietly replace PROB5authigh =  probAhigh  if ar_axis==a
>         drop x_beta* prob*  
>         local a = `a' + .2
>  }
>  label var ar_axis "Aid + Remit"
>   label var PROB5dem "Coalition failure"
>   label var PROB5aut "Coalition failure"
>  sort ar_axis
>  twoway (line PROB5dem ar_axis)  (line PROB5aut ar_axis) 
>  saveold Arep5, replace
>  
>   * (6) *
>  use temp_Ahmed_Svolik, clear
>  set more off
>  probit turnover_norcfail aid_remit beta3 beta3_AR finittrm lngdpcap ggdpcap lnpop war
>  ldis hdis time_dum*  codummy* ydummy*  if sumsamp==1, cluster(govtcode)
>  drawnorm b1-b343, n(10000) means(e(b)) cov(e(V))  clear 
>  gen PROB6dem=.
>  gen PROB6demlow=.
>  gen PROB6demhigh=.
>  gen PROB6aut=.
>  gen PROB6autlow=.
>  gen PROB6authigh=.
>  gen a =.
>  gen ar_axis = (_n-1)/5 + 0.5 if _n<=132
>  /*We want nt to run from 0.5 to 26.5, ie from 5pctile to 95pctile*/ 
>  local a=0.5
>  while `a' <= 26.5 {
>         gen x_betaDem  = b1*`a'+b2*.05+b3*.05*`a'+b4*1+b5*6.86+b6*1.34+b7*16.06+b8*0+b
> 9*0+b10*0+b343*1
>         gen x_betaAut  = b1*`a'+b2*.5+b3*.5*`a'  +b4*1+b5*6.86+b6*1.34+b7*16.06+b8*0+b
> 9*0+b10*0+b343*1
>         gen probD = normal(x_betaDem)
>         gen probA = normal(x_betaAut) 
>         egen probDhat = mean(probD)
>       _pctile probD, p(2.5,97.5) 
>       scalar probDlow= r(r1) 
>       scalar probDhigh= r(r2) 
>         egen probAhat = mean(probA)
>       _pctile probA, p(2.5,97.5) 
>       scalar probAlow= r(r1) 
>       scalar probAhigh= r(r2) 
>         quietly replace a = `a' 
>         quietly replace PROB6dem =  probDhat  if ar_axis==a
>         quietly replace PROB6demlow =  probDlow  if ar_axis==a
>         quietly replace PROB6demhigh =  probDhigh  if ar_axis==a
>         quietly replace PROB6aut =  probAhat  if ar_axis==a
>         quietly replace PROB6autlow =  probAlow  if ar_axis==a
>         quietly replace PROB6authigh =  probAhigh  if ar_axis==a
>         drop x_beta* prob*  
>         local a = `a' + .2
>  }
>  label var ar_axis "Aid + Remit"
>   label var PROB6dem "Coalition survival"
>   label var PROB6aut "Coalition survival"
>  sort ar_axis
>  twoway (line PROB6dem ar_axis)  (line PROB6aut ar_axis) 
>  saveold Arep6, replace
>  
>  
>  use Arep1, clear
>  sort ar_axis
>  merge ar_axis using Arep2
>  sort ar_axis
>  drop _merge
>  merge ar_axis using Arep3
>  sort ar_axis
>  drop _merge
>  merge ar_axis using Arep4
>  sort ar_axis
>  drop _merge
>  merge ar_axis using Arep5
>  sort ar_axis
>  drop _merge
>  merge ar_axis using Arep6
>  sort ar_axis
>  drop _merge
>  merge using temp_Ahmed_Svolik
>  set scheme lean1
>  label var aid_remit "Aid + Remit distribution"
>  sort ar_axis
>  drop _merge
>  
> twoway  (hist aid_remit if aid_remit<=26.5 & sumsam==1 & aid_remit>=0.5, lcolor(gs12) 
> bin(100)) /*
> */ (line PROB1aut ar_axis if ar_axis<=26.5, yaxis(1))  /*
> */ (line PROB2aut ar_axis if ar_axis<=26.5, yaxis(1))  /*
> */ (line PROB3aut ar_axis if ar_axis<=26.5, yaxis(1))  /*
> */ ,  xtitle("Aid + Remit (%GDP)", size(3.5)) ytitle("Pr(Failure)", size(3.5)) /*
> */  legend(pos(12) col(2) ring(1) label(1 "Aid + Remit distribution")  label(2 "All fa
> ilures") label(3 "Coalition failure") label(4 "Coalition survival"))  xscale(range (0 
> 26)) xlabel(0 (5) 25)
> *graph export "C:\Users\jwright\Documents\My Dropbox\Research\Autocratic Instability\A
> hmedReplication_Svolik.pdf", as(pdf)                            replace
> 
> twoway  (hist aid_remit if aid_remit<=26.5 & sumsam==1 & aid_remit>=0.5, lcolor(gs12) 
> bin(100)) /*
> */ (line PROB4aut ar_axis if ar_axis<=26.5, yaxis(1))  /*
> */ (line PROB5aut ar_axis if ar_axis<=26.5, yaxis(1))  /*
> */ (line PROB6aut ar_axis if ar_axis<=26.5, yaxis(1))  /*
> */ ,  xtitle("Aid + Remit (%GDP)", size(3.5)) ytitle("Pr(Failure)", size(3.5)) /*
> */  legend(pos(12) col(2) ring(1) label(1 "Aid + Remit distribution")  label(2 "All fa
> ilures") label(3 "Coalition failure") label(4 "Coalition survival"))  xscale(range (0 
> 26)) xlabel(0 (5) 25)
> *graph export "C:\Users\jwright\Documents\My Dropbox\Research\Autocratic Instability\A
> hmedCorrected_Svolik.pdf", as(pdf)                            replace
> 
> */
. 
end of do-file

. 
. 
. ******* The END ********
. 
. 
. log close
      name:  <unnamed>
       log:  C:\Users\jwright\Dropbox\Research\Autocratic Instability\R&A Revision\Wrigh
> tBak Replication\AutocraticInstability.log
  log type:  text
 closed on:   9 Dec 2015, 12:26:04
----------------------------------------------------------------------------------------
